matlab中若是想从循环语句中直接返回该怎么弄
答案:2 悬赏:80
解决时间 2021-12-31 10:27
- 提问者网友:践踏俘获
- 2021-12-31 02:51
matlab中若是想从循环语句中直接返回该怎么弄
最佳答案
- 二级知识专家网友:傲娇菇凉
- 2021-12-31 04:30
please use the break order
for Example
The example below shows a while loop that reads the contents of the file fft.m into a MATLAB? character array. A break statement is used to exit the while loop when the first empty line is encountered. The resulting character array contains the M-file help for the fft program.
fid = fopen('fft.m','r');
s = '';
while ~feof(fid)
line = fgetl(fid);
if isempty(line), break, end
s = strvcat(s,line);
end
disp(s)
that's ok
for Example
The example below shows a while loop that reads the contents of the file fft.m into a MATLAB? character array. A break statement is used to exit the while loop when the first empty line is encountered. The resulting character array contains the M-file help for the fft program.
fid = fopen('fft.m','r');
s = '';
while ~feof(fid)
line = fgetl(fid);
if isempty(line), break, end
s = strvcat(s,line);
end
disp(s)
that's ok
全部回答
- 1楼网友:劳资的心禁止访问
- 2021-12-31 06:03
使用save语句
如
save('matrix.dat',x)
如果每次循环的结果都保存到不同的文件中,可以用
i=i+1;
save(strcat('matrix',num2str(i),'.dat'),x)
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯
• 手机登qq时,显示手机磁盘不足,清理后重新登 |
• 刺客的套装怎么选啊? |