Output Pop-Up Window

36 ビュー (過去 30 日間)
Sarah Smith
Sarah Smith 2020 年 6 月 25 日
コメント済み: Walter Roberson 2020 年 6 月 25 日
I want to make my displayed text in the output display as a popup window but I'm not sure now. My output currently reads "fprintf('Body mass changes by = %.5f +/- %.5f cm^3'" which in turn only gives these typed out in the command window. If you could help me get them to come up in a Pop Up window, thank you!

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 6 月 25 日
編集済み: Walter Roberson 2020 年 6 月 25 日
You can use msgbox() . If you look at the documentation for msgbox() you will see there is a way to configure using 'tex' interpreter to help with outputing symbols.
You will need to use compose() or sprintf() to construct the message. When you do that, be careful, because compose and sprintf both expect \ to be the introducer for "escape characters", such as \n coding for newline. That is a problem when you are trying to build up tex commands. You will need to code \\ in each place you want \ to be present in the tex .
Note that interpreter latex is not documented as being supported; however when I examine the code in R2020a, I see that latex is implemented.
  2 件のコメント
Sarah Smith
Sarah Smith 2020 年 6 月 25 日
I was able to get the popup box, thank you! But I am still unable to assign a changing variable to the box. Ex. What the body mass would be form my example when the variables are changed
Walter Roberson
Walter Roberson 2020 年 6 月 25 日
msg = sprintf('Body mass changes by = %.5f ± %.5f cm³\n', value1, value2);
h = msgbox(msg)

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

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by