output of function as a string
38 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Tor Fredrik Hove
le 31 Oct 2011
Modifié(e) : Walter Roberson
le 7 Avr 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 commentaires
Réponse acceptée
Titus Edelhofer
le 31 Oct 2011
Hi,
yes it can: disp displays the string in the command window. Just write
answer='less than 50'
Titus
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!