我还不太了解他们在这里说的所有内容:http : //www.mathworks.nl/help/matlab/ref/try.html以及所有这些带有MException类的东西...基本上在这样的结构中
for ii = 1:number
try
do stuff
catch
end
end
我怎么能这样做,以保持在一个文件/电池/结构/ ...所有错误的事情,(无论)有,例如,迭代II出了什么问题?
我想你可以这样
Errors ={};
for ii = 1:number
try
%do stuff
catch err
Errors{end + 1, 1} = err;
Errors{end, 2} = ii; %note that 'end' in this line will be the same row as 'end + 1' from the line just above it
end
end
现在,每个错误将保存在第一列的“错误”的新行中,第二列将包含ii
与该错误相对应的迭代值(即原来的值)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句