Running scripts - command line Vs. within another script

1 view (last 30 days)
Hi there,
I have encountered a rather odd discrepancy between running a series of scripts on the command line and via another script
If I copy and paste the following code into the command line everything runs fine :
cd 'correctdirectory'; SCRIPT1
cd 'correctdirectory'; SCRIPT2
cd 'correctdirectory'; SCRIPT3
However placing the same code into a script and running results in some problems. There is no error reported, however at some (not consistent) point in SCRIPT3 the run seems to grind to a halt.
I can only presume this is some sort of memory issue, as SCRIPT3 is quite memory intensive. However this doesn't explain why it still runs fine from the command line.
So, my question is what kind-of differences are there in memory allocation between running directly from the command line and from within a script, if any? And, not at all being an expert on memory, what kind of diagnostics could I look at when debugging to try get to the root of the problem?
BTW I want to share the same workspace between the scripts, hence why not using functions. Also, I'm using 2012a on a 64bit windows 7 machine.
Cheers, Eoghan
  1 Comment
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh on 13 Mar 2014
Seems funny! I suggest to place a pause between he lines and see what happens, cuz the only difference I can see is that you're giving your computer some time to deal with your commands, so do the same as in your code. I was trying to stop, then delete then create the same analog output the other day, in the script file, it seem to be so fast for the DAQ device that it was getting irresponsive, it was getting started before even stopping,toally out of control!, so I tried a pause(1) and everything worked out fine.
Let me know about the results if you test it plz.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!