Here's a problem I had for several years now, and never found an easy solution for it.
I have two matlab scripts, say script1.m and script2.m. These are both scripts which take several hours of calculation. I ran script1.m and waited for a couple of hours. Next (while script1.m was still executing) I accidently pressed the "Run" button for script2.m in the same matlab window. script2.m starts with "close all; clear all;" and hence all my results will be erased when script2.m starts, which is like 1 millisecond after the completion of script1.m. Is there a way to prevent matlab from executing script2.m (without changing my programming style)?
I could ofcourse modify script2.m and put the command "return" on its first line and save it, but I would love to know if there's a more elegant way of doing this (without changing my programming style)?
Best Answer