How do I define MAIN as Master script?

28 views (last 30 days)
Stwiwi on 10 Oct 2018
Commented: Jan on 13 Apr 2021
Hey people, so I have this MAIN from where I run all my functions. Is there maybe a possibility to run the MAIN while I'm in one of the other functions by pressing F5? This way I would not have to change the script every time I want to run the MAIN. It's kind of annoying to always switch between the scripts... Maybe someone can help me:) Thanks so much Steffen
Stwiwi on 10 Oct 2018
okay I think this answers my question, so its not possible. Thanks

Sign in to comment.

Answers (2)

Jan on 10 Oct 2018
Instead of switching scripts, use functions with defined inputs and outputs. Searching for tricks to handle scripts more dynamical is a deadlock. Structured programming by using functions allows to keep the workspace clean and to be able to recreate the outputs reliably. So do not waste your time with managing scripts.

Antonio Sala
Antonio Sala on 12 Apr 2021
Even if an old question, I wish to add my complaints here... I need some place to relieve my stress...
Come on, in the 1990's I had my C, C#, LaTeX etc. editors, and when you are editing a multifile "project" most of them offer you the option to "set xxxx.m/c/tex as main file". It's weird that at least the "project" workflow in Matlab does not have this silly and straightforward feature (or I don't know how to trigger it).
If somebody at Mathworks is listening, please do what many IDEs did 20 years ago:
1.) allow an "entry point" on a multi-file project (either a main.m script, a main() function, or any script that can be set to be the "main one") to be executed when F5 is pressed.
2.) Save and restore editor open windows when project is closed/reopened.
Well, this question is just about option 1) feature request, but, well... I find "project" stuff sooo disappointing compared to Visual Studio projects from 20 years ago...
  1 Comment
Jan on 13 Apr 2021
You can post this as a new question or, even better, send this directly to MathWorks as an enhancement request. Appending a complaint in the section for answers of another question hides your opinion efficiently.

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!