How to continue running a script using a saved workspace

Dear Community member, I'm a newbie to Matlab programming and I need your assistant. I'm running a script which needs 4 days or more to finish, some time bluescreens appear in windows7 and I'm obliged to restart the computer, please how can I start the simulation from the point of the crush. If I simply load the saved workspace and update the for loop and then I push the run button all the previous data are set to zeros and it starts with he updated loop.
Exemple: the for loop is from i=1 to 16 after a crush i=5 , I change the m-file with i=5 to 16 and I run it, data calculated from i=1 to 4 are automatically set to 0??? how can I fix it?
Thank you for taking your time reading this. Kind Regards

5 commentaires

I'd suggest to ensure have all updates installed in Windows and drivers, etc., also latest revisions for specific hardware. Also ensure anti-virus protection is on and up-to-date and do scans and fix any issues found.
Win 7 in general is pretty stable; if you're having frequent BSODs, in all likelihood there are "issues".
thanks for your reply, waiting to fix windows problems I need to know how to resume the execution of m-file with a saved workspace but not from the beginning??
Did you read the answer and follow those directions?
windows and drivers are up-to-date, it's probably a problem due to an overheating due to the non-stop computer running day and night. but please I need to resolve this issue: Q: ''how to resume the execution of a MATLAB file with a saved workspace near the crash point, not from the beginning?? ''
dpb
dpb le 9 Juin 2018
Modifié(e) : dpb le 9 Juin 2018
I provided the Answer besides the comment...have you not read/tried that?

Connectez-vous pour commenter.

Réponses (2)

dpb
dpb le 9 Juin 2018
Modifié(e) : dpb le 9 Juin 2018
You'll have to fix your script such that you don't reallocate data arrays when restarting with a changed lower index of the for loop. Of course, you'll have to be SAVE -ing the workspace after each iteration completes but if do that then you should have no problem in filling in the output arrays picking up from where quit.
Posting the beginning of the script could potentially make it nearly trivial for somebody to point out how to make such changes (then again, depending on the script itself, it might be nearly impossible :) ).
ADDENDUM
If you were to modify the script to a function, then you could recode it to accept the lower index and a restart flag and avoid making any coding changes at all; simply call the function with the proper arguments.
Walter Roberson
Walter Roberson le 9 Juin 2018
Divide your code into two parts. The first part initializes arrays and variables; the second part does the calculations, saving state occasionally. Create two versions of the first part, one for starting from scratch and the other version for loading a saved file and using it to initialize the required variables.

Catégories

En savoir plus sur Scope Variables and Generate Names dans Centre d'aide et File Exchange

Tags

Question posée :

le 9 Juin 2018

Modifié(e) :

dpb
le 9 Juin 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by