display a message in a message box

7 次查看(过去 30 天)
i wanted to display a message in a message box saying...
Disease identified as Tumor,
Disease identified as Cancer, etc...
Disease identified as is constant.. tumor, cancer etc will be stored in a variable named as 'DiseaseIdentified' and i'll have to get it from that variable....
i did as below... but i'm getting error.... please could someone show me how to write it....
msgbox(sprintf('Disease identified as %s',DiseaseIdentified));
  2 个评论
Jan
Jan 2013-1-4
Whenever you post in the forum, that you get an error, add the complete message also. Currently an answer requires to guess what's going on, and if our guesses are wrong, an answer can be worse than no answer.

请先登录,再进行评论。

采纳的回答

Image Analyst
Image Analyst 2013-1-4
You may want to use uiwait() so the message pauses there and waits for the user, and does not keep barreling along with the rest of your code, as just a plain msgbox will.
message = sprintf('Disease identified as %s', DiseaseIdentified{1});
uiwait(warndlg(message)); % Waits, and displays exclamation point.
or, if it is normal
uiwait(helpdlg(message)); % Waits, and displays info text balloon.
uiwait(msgbox(message)); % Waits, and displays no icon at all.

更多回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-1-4
编辑:Azzi Abdelmalek 2013-1-4
Maybe is that what you want
msgbox(sprintf('Disease identified as %d',1));
or
DiseaseIdentified='cancer'
msgbox(sprintf('Disease identified as %s',DiseaseIdentified));
  3 个评论
Seban
Seban 2013-1-4
As it said, you can't use cell input in sprintf. You need to make sure DiseaseIdentified is a string.
Azzi Abdelmalek
Azzi Abdelmalek 2013-1-4
Use
DiseaseIdentified={'cancer'}
msgbox(sprintf('Disease identified as %s',DiseaseIdentified{1}));

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Biotech and Pharmaceutical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by