How do one save the output of matlab script when it runs for many days?
8 ビュー (過去 30 日間)
古いコメントを表示
Hello all---
I have a matlab script that run for 6-7 days. But, to be on safer side i want to save the output of the script at regular interval.This is to avoid the chances of loosing the data in case of unexpected termination. Is there a way to do this ?
In the script, there are loops inside a function.
Thanks in advance !
0 件のコメント
回答 (2 件)
KSSV
2019 年 1 月 31 日
YOu can save the data into a mat file....check the following example:
filename='test.mat';
m = matfile(filename, 'Writable', true); %Note: writable is true by default IF the file does not exist
for i = 1:10
x = randn(1,100);
out = x.^2; %whatever you put into out is overwritten here anyway
m.out(i, 1:100) = out;
end
clear m;
2 件のコメント
Muhamed Eliyas
2020 年 10 月 6 日
Display the current state of your knowledge • Calculate currentKnowledge using the same relationship as before, and the t we just calculated: k= −1 e−t/τ • Display the following text: At this time, I know X% of MATLAB
Please answer me with output
Walter Roberson
2019 年 1 月 31 日
If you are talking about output to the command window, then you can use diary
Otherwise there is pretty much only save . You could consider having a timer object save the current content of variables that are in the base workspace.
2 件のコメント
Walter Roberson
2019 年 2 月 6 日
You can call save() yourself, or you can use KSSV's idea of using matfile which will automatically write into the file, even extending variables, which might be more efficient.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!