MATLAB: Output of function as a string

outputstring

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?

Best Answer

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