?? accumulate.m
字號(hào):
function result = accumulate(x)% PURPOSE: accumulates column elements of a matrix x%---------------------------------------------------% USAGE: result = accumulate(x)% where: x = an nobs x nvar matrix or vector%---------------------------------------------------% RETURNS:% results = nobs x nvar matrix containing cumulative sums% of the column elements of the matrix argument x %--------------------------------------------------% written by:% James P. LeSage, Dept of Economics% University of Toledo% 2801 W. Bancroft St,% Toledo, OH 43606% jpl@jpl.econ.utoledo.eduif (nargin ~= 1)error('Wrong number of arguments to accumulate');end;[nobs nvar] = size(x);result = zeros(nobs,nvar);for j=2:nobs;for i=1:nvar;result(1,i) = x(1,i);result(j,i) = result(j-1,i) + x(j,i);end;end;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -