Tags: box, boxthe, display, following, inmessage, istit, matlab, message, programming, sens288message, syntax, value, variable

how to display value of variable in a message box

On Programmer » Matlab

1,285 words with 2 Comments; publish: Wed, 07 May 2008 11:50:00 GMT; (20045.90, « »)

i have a very simple problem... i want to display few results in

message box

the syntax i am following is



message= 'Sensitivity ' +sens;

message=[message;' is the result '];


the value of variable sens does not appear either it gives an error or

gives strange characters as output.

plz reply n help me...

thanx in advance


All Comments

Leave a comment...

    • i presume you need to use the brackets [] to perform the string

      concatenation but also you need to convert your numerical information

      to a string prior to the concatenation.

      message = ['Sensitivity ', num2str(sens)];

      also you should remember when working with strings, when performing the

      string concatenation ',' results in column concatenation while ';'

      results in row concatenation, so i believe:

      message = [message ; ' is the result'] results in a two line result


      message = [message , ' is the result'] does not.

      #1; Wed, 07 May 2008 11:51:00 GMT
    • hi,

      you can fix it as shown below:



      message= ['Sensitivity' ' ' num2str(sens) ' is the result ']


      good luck

      #2; Wed, 07 May 2008 11:52:00 GMT