MATLAB Answers

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

8 views (last 30 days)
Guitarist Pandey
Guitarist Pandey on 10 Jun 2017
Edited: Stephen Cobeldick on 10 Jun 2017
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 Comments

Sign in to comment.

Answers (1)

Stephen Cobeldick
Stephen Cobeldick on 10 Jun 2017
Edited: Stephen Cobeldick on 10 Jun 2017
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 Comments

Sign in to comment.

Sign in to answer this question.

Tags