Skip to content Skip to sidebar Skip to footer

Running Multiple M-files By Batch On Windows Os "without" Closing Previously Run M-file

My purpose is to sequentially running a series of m-file and python programs. And thanks to Mofi, Shai, and moarningsun, I could find out that this batch file is successful on my W

Solution 1:

Option 1:

You can save all the relevant variables to a mat file at the end of aatest1 and load them at the begining of aatest2.

Option 2:

You can run your python script in matlab (without terminating aatest1). Use matlab's system command to run the python script in Matlab:

[status,cmdout] = system( 'C:\python27\python.exe python.py input.xlsx' );

Solution 2:

I suggest to write the names of the variables and their values you want to pass from aatest1.m to aatest2.m into a file in a format like:

variable1=value
variable2=value

aatest1.m creates this file with the names of the variables and their values, and aatest2.m reads the values from the file and initializes with those values the appropriate variables.

The batch file can finally after execution of aatest2.m delete the temporary used file to pass values of variables from one MATLAB script to next MATLAB script if there is no MATLAB function to delete a file directly from within aatest2.m.

Post a Comment for "Running Multiple M-files By Batch On Windows Os "without" Closing Previously Run M-file"