How do one save the output of matlab script when it runs for many days?
28 views (last 30 days)
Show older comments
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 Comments
Answers (2)
KSSV
on 31 Jan 2019
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 Comments
Muhamed Eliyas
on 6 Oct 2020
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
on 31 Jan 2019
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 Comments
Walter Roberson
on 6 Feb 2019
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.
See Also
Categories
Find more on Debugging and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!