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?

 採用された回答

Titus Edelhofer
Titus Edelhofer 2011 年 10 月 31 日

1 投票

Hi,
yes it can: disp displays the string in the command window. Just write
answer='less than 50'
Titus

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCharacters and Strings についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by