Sunday 15 September 2013

MATLAB: wat is the shortest way to display a string and a variable on 1 line? -



MATLAB: wat is the shortest way to display a string and a variable on 1 line? -

i'm know question has been asked lot, see different answers everywhere. i'm trying display string , variable on same line. know there several ways it, num2str or first creating string , display string. can tell me shortest/simplest way accomplish this? creating string , display string seems bit devious..

i need many times nice if display multiple lines each line contains text , variable. can echo"the reply $var"; in php?

thanks in advance

the best way larn fprintf works.

fprintf ( 'string , format specifier %d or %f\n', value, anothervalue )

fprintf powerful , lot faster other methods

see http://www.mathworks.co.uk/help/matlab/ref/sprintf.html examples of how format string.

another useful feature write

fprintf ( 2, 'using fprintf in way writes text in red\n' )

string matlab variables

No comments:

Post a Comment