Ques:Regardless of input, output the string 'yes'.

조회 수: 1 (최근 30일)
Guitarist Pandey
Guitarist Pandey 2017년 6월 10일
편집: Stephen23 2017년 6월 10일
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...

답변 (1개)

Stephen23
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.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by