What Should Happen when a Live Script is Executed from the Command Line?

I have a Live Script myscript.mlx. I accidentally used myscript as a command on the command line
>> myscript
As soon a I hit enter, I realized that I had no idea what was suppose to happen? Should the LiveScript editor open with the script executing? Something else?
As it turned out, nothing happened. I got the "Busy" status in the lower left of the Matlab window. Waited a while and when nothing seemed to be happening I tried to get back control with ctrl-c, and opening the Live editor and clicking on Stop. Nothing happened. Eventually had to end the Matlab process (Win 10).

 採用された回答

Cris LaPierre
Cris LaPierre 2022 年 2 月 20 日
編集済み: Cris LaPierre 2022 年 2 月 20 日

0 投票

It should run your script. Any lines of code without a semicolon will print their output to the command window, and any figures will open in figure windows.
Just note, though, that for figures, live scripts keep reusing the same figure unless you explicitly tell it to create a new figure. Inside the live script, you will see a snapshot of your figure anytime you modify it. However, when you run the live script from the command window, only the final figure is displayed.

1 件のコメント

Paul
Paul 2022 年 2 月 20 日
OK. I just quit Matlab, restarted, and tried it again. It worked exactly as you said. No idea what was different this time.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2021b

質問済み:

2022 年 2 月 20 日

コメント済み:

2022 年 2 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by