Restart variable from a middle point
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have a for loop for a variable, let's call it X=linspace(a,b,c);
Now, imagine that I am calculating a variable M that depends on the values of X and suddenly Matlab stops.
How can I be sure that I store M until that point?
How can I restart the loop from the exact point that the calculation stopped?
Thanks in advance!
0 件のコメント
回答 (1 件)
Matt J
2019 年 2 月 11 日
You could save M to a .mat file in every iteration of the loop. That will slow things down, however.
3 件のコメント
Matt J
2019 年 2 月 11 日
編集済み: Matt J
2019 年 2 月 11 日
You could save the iteration number as well. That way you would know where it stopped and you could re-launch the loop from that point.
load dumpFile M X lastIteration
for x=X( lastIteration+1:numel(X) )
...
end
Why do you expect Matlab to suddenly stop?
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!