MATLAB: How to create a function that decides whether a word contains 5 letters or more

words

function fiveletters(input)
if (input,[])>4
fprintf('This word contains 5 or more letters\n');
else
fprintf('This word contains less than 5 letters\n');
end
end

Best Answer

Try this:
function y=fiveletters(x)
if isstring(x)
x=char(x);
end
if numel(x)>=5
fprintf('This word contains 5 or more letters\n');
y=true;
else
fprintf('This word contains less than 5 letters\n');
y=false;
end
end