How would i write this str?
Mostrar comentarios más antiguos
how would i format this,
MyAge = 6
FreindName = 'Joe'
FreindAge = 4
disp(['My',' friend',"'",'s', ' age is', FreindAge, ' years.'])
im trying to get it to display 'My freind's age is (veriable) years'
Respuestas (1)
I always use fprintf
MyAge = 6;
FreindName = 'Joe';
FreindAge = 4;
fprintf("My friend %s's age is %d years.\n", FreindName, FreindAge)
1 comentario
Dyuman Joshi
el 6 de Dic. de 2023
+1 for fprintf
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!