Execute the same calculus to different data files

Xaero Chang xaerochina at gmail.com
Tue Aug 5 11:03:26 CDT 2008


> Imagine that I have twenty new files (data files) called ff2,  
> ff3,...ff20 external files with diferent matrix information I want to  
> use.

> I want to create a function (I know that this example is wrong) similar  
> to this:
> for i=1:20
> A(i)=load("ff(i).m")
> B(i)=A(i)+2
> end

The following lines may do this:
for i=1:20
   filename=['ff',num2str(i),'.m'];
   A(i)=load(filename);
end

-- 
Best Regards!
---------------------------
Sincerely Yours             Chengqi Chang
China Center for Economic Research
Mail/MSN: XaeroChina at Gmail.com
Personal Website: http://xaero.mmiyy.cn


More information about the Help-octave mailing list