MATLAB: Beginner… why a matrix with numbers and strings doesn’t give me the numbers? ( I know I have to transform the numbers into strings)

how it worksmatrixnumbersstrings

I just would like to know how it works.
e.g
t = 71 ;
c = (t-32)/1.8 ;
hey = ['The temperature is , c , 'C']
  1. it's not going to work! I have to use a command to transform "c".why???
a = [ 'how's it going' , 10 , 'cool' ]
it will give me both strings but not the number 10 ….
it looks like there's no "10" in "a" ..
thanks for helping

Best Answer

a = [ 'how''s it going' , num2str(10) , 'cool' ];
or
a = sprintf('how''s it going %d cool' 10];
or
a = sprintf('%s %d %s', 'how''s it going', 10, 'cool' ];