MATLAB: Display a message in a message box

messagebox

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));

Best Answer

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.