我有這樣一個循環:如何在MATLAB中使用循環變量創建一個字符串?
for i=1:no
%some calculations
fid = fopen('c:\\out.txt','wt');
%write something to the file
fclose(fid);
end
我想將數據寫入到不同的文件是這樣的:
- 爲
i=1
,數據被寫入到out1.txt
- 爲
i=2
,數據是寫入out2.txt
- 對於
i=3
,數據寫入out3.txt
- 等
做'out'+ i
不起作用。 這個怎麼辦?
int2str(i)not int2str(1) – MatlabDoug 2009-11-06 15:04:23