Trying to display text and variable in a single output line. I was initially trying to use disp then a matrix then fprintf
305 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
desired output:
The answer is: 800 %
I am trying to display this sentence in a single line of output in the command window. thankyou
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Milly
am 19 Jun. 2024
Bearbeitet: Milly
am 20 Jun. 2024
Not quite sure what issue the author had with the "disp" function but this should be the most efficient way to do this.
The given example would look like this:
var1 = 800;
disp("The answer is: " + var1 + " %")
The accepted answer using the disp function would look like this:
name = "Alice";
age = 12;
disp(name + " will be "+ age + " this year.")
0 Kommentare
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!