Why does the RUN button not work for my script?

374 次查看(过去 30 天)
I have a script that runs fine when I hit "Ctrl+Enter", but does not do anything when I hit the 'Run' button. The 'Run' button is green, and presses down like normal, but the script does not execute.
Running the code line-by-line works fine, and I can even copy/paste it into a new file. Why doesn't 'Run' work?

采纳的回答

MathWorks Support Team
This may occur in some cases if you create a variable with the same name as your file.
Once the variable is created and exists in your workspace, it becomes a matter of shadowing. When you press the 'Run' button, MATLAB essentially pastes the name of your script into the command window. This means that if you have a variable of the same name, MATLAB will only print out the value of this variable but will not execute the script.
To work around this issue, you can simply rename your file or your variable.
  2 个评论
Walter Roberson
Walter Roberson 2025-2-19
Toushif comments
nop, thts definitely not he issue, even simple addition of two number while accepting input from command window, even such simple script does not run. when run butto is clicke it just lags , cant stop cant do anything, the message at the bottom shows waiting for input but the terminal does not have any response its just blank.
Kautuk
Kautuk 2025-2-24
@Toushif: Please share more details of your workflow in which you are facing this issue. Alternatively, feel free to reach out to MathWorks Technical Support.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by