フィルターのクリア

how do i display text in command window matlab LiveScript?

137 ビュー (過去 30 日間)
Rubem Pacelli
Rubem Pacelli 2019 年 4 月 30 日
回答済み: 埃博拉酱 2024 年 5 月 22 日
Every time that i'd like use the command "display" or "disp ", the text is showing in Live Script file. how do i display this text in command window?
display('Wello World');
  3 件のコメント
K.
K. 2021 年 5 月 11 日
Can you share a little more about what you are trying to accomplish and why you'd like it to go to the Command Window? This might help us find a better workaround for you, and will help us understand how we might be able to improve the Live Editor for your use case.
Also, are you looking for all output to go to the Command Window (with figures in separate windows), or only the output from specific lines of code?
Francisco Serra
Francisco Serra 2023 年 12 月 14 日
@K. Hello. Regarding your second question:
"Also, are you looking for all output to go to the Command Window (with figures in separate windows), or only the output from specific lines of code?"
Any of those would be great. Is there any option for any of those?

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

回答 (5 件)

Joe Bienkowski
Joe Bienkowski 2020 年 5 月 12 日
There is currently no MATLAB command or option within the Live Editor to do this. One technique to get outputs into the Command Window is to run the script from the Command Window. This will result in any "disp" or "display" commands to be shown in the Command Window.

Sarah T
Sarah T 2020 年 7 月 1 日
The "input" function works (although it is designed for a different purpose, it does print to the command window)

Jan Frouws
Jan Frouws 2021 年 6 月 16 日
編集済み: Jan Frouws 2021 年 6 月 16 日
This is not directly an answer to this question, but it helped me with a related problem:
how to display text in the command window from simulink 'block property callbacks' like the 'OpenFnc' callback.
This post: From 'Undocumented Matlab' offers a function (cprintf) to print text to the command line with configurable colours.
As its working principle it directly manipulates the command window which has helped me at least.
Hopefully this is helpfull for someone.
Kind regards, Jan

Kouichi C. Nakamura
Kouichi C. Nakamura 2021 年 5 月 11 日
As Sarah T wrote, input can show text in Command Window, but it prompts user input. Sometimes you don't want that.
If your purpose is to show some information visible outside of Live Editor, msgbox may be used as workaround.
f = msgbox('Operation Completed');
f.WindowStyle = 'docked'
This can show the message in a docked window instead of Command Window. You can use Latex syntax.

埃博拉酱
埃博拉酱 2024 年 5 月 22 日
T=toc;
timer(TimerFcn=@(~,~)display(T),StartDelay=0.1).start;

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by