Alvi Syahrin
Alvi Syahrin

Reputation: 383

Showing Variable's Value on Message Box

This is a very simple problem, I have been trying it for some times, but not working.

I have this code:

[s,h]=silhouette(cobat,g,'SqEuclidean')

MS = mean(s)

z = [cobat s];

I want to show the MS value on message box. The message box is going to be like this, 'The result is [here MS value will be placed]'

Any idea?

Upvotes: 2

Views: 8586

Answers (1)

Digna
Digna

Reputation: 882

You could do it the following way:

h = msgbox(['The result is ' num2str(MS)], 'Title of the message box')

With num2str I convert the numerical result to a string, and with the square brackets I concatenate "The result is " with the result to display it in the message box.

Upvotes: 6

Related Questions