How do I define MAIN as Master script?

26 次查看(过去 30 天)
Stwiwi
Stwiwi 2018-10-10
评论: Jan 2021-4-13
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
  4 个评论
Adam
Adam 2018-10-10
I'm pretty sure you cannot redefine the behaviour of F5. Just pressing the up arrow in the windows command line or typing it in again if you did other things since last calling it though is not that arduous!
Stwiwi
Stwiwi 2018-10-10
okay I think this answers my question, so its not possible. Thanks

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2018-10-10
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 2021-4-12
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 个评论
Jan
Jan 2021-4-13
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by