Ques:Regardless of input, output the string 'yes'.
1 次查看(过去 30 天)
显示 更早的评论
my solution:-
function wiferight(in)
fprintf('yes');
end
what is wrong with my solution?.... Cody says its wrong.... but when i runned it on MATLAB, it is running...
0 个评论
回答(1 个)
Stephen23
2017-6-10
编辑:Stephen23
2017-6-10
Your function does not actually output anything: your function prints some text to the command window, but printing text using fprintf is a totally different thing to returning an output argument.
How to define MATLAB functions with outputs is a very basic MATLAB concept that is explained in the introductory tutorials (these are highly recommended for all beginners):
How to define MATLAB functions with outputs is also clearly explained in the function help:
Instead of guessing how to use MATLAB, beginners should start to read the MATLAB documentation: the documentation tells us all how to use MATLAB.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!