output of function as a string
26 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tor Fredrik Hove
il 31 Ott 2011
Modificato: Walter Roberson
il 7 Apr 2021
function answer=harflertall(a)
if a==50
answer=disp('it''s a tie')
elseif a<50
answer=disp('less than 50')
else
answer=disp('more than 50')
end
can not output be assigned to be a string?
0 Commenti
Risposta accettata
Titus Edelhofer
il 31 Ott 2011
Hi,
yes it can: disp displays the string in the command window. Just write
answer='less than 50'
Titus
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!