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 个评论
dpb
2018-6-9
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".
adel
2018-6-9
dpb
2018-6-9
Did you read the answer and follow those directions?
adel
2018-6-9
回答(2 个)
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
2018-6-9
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Scope Variables and Generate Names 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!