How do one save the output of matlab script when it runs for many days?
    10 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
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 Commenti
Risposte (2)
  KSSV
      
      
 il 31 Gen 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 Commenti
  Muhamed Eliyas
 il 6 Ott 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
      
      
 il 31 Gen 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 Commenti
  Walter Roberson
      
      
 il 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.
Vedere anche
Categorie
				Scopri di più su Variables in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



