How to execute multiple m files in current project from command line in windows?
Show older comments
Hi,
I have got a large simulink project an multiple m files to run in this project. At the moment I start to first m file which loads the project with the following command
matlab -r "run('matlabfile1.m')"
in windows command line. When matlabfile1 finished the file closes itself but not the simulink project. In the next step I would like to run the second (and more) m file in the same project.
I have the following ideas:
- run a matlab file automatically when opening it. Perhaps there exists a way to implement that
- run the next matlab file in a new matlab instance and communicate between the matlab instances so that the file is able to run the simulink project
- run a seperate matlab file in the background which is watching for commands (perhaps from windows command line) to run different matlab files
Are there some ideas to solve my problem?
3 Comments
What does "the file closes itself" mean? Which file closes what?
What does the "it" mean in "run a matlab file automatically when opening it"?
If you start a new Matlab instance for each M-file and "communicate" with a formerly existing Matlab session, you will end at N open Matlab sessions for N m-files. This will exhaust your memory soon.
Sandra
on 14 Dec 2018
Jan
on 14 Dec 2018
Why do you open the editor at all if you want to run the code?
exit is equivalent to quit.
I'm still not sure about what the problem is. Do you want to start a bunch of scripts one after the other without closing Matlab?
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!