function [cd,a,b]=picker(cd,a,b);
if picker(a<b,a,b)
fprintf('out=a');
else
fprintf('out=b')
end
Your function ignores the first input entirely, and then for no obvious reason it recursively calls itself, providing its first input (which is ignored anyway) as being the output of the comparison a<b (a comparison which is not mentioned anywhere in your assignment). Then you provide three outputs from the function, none of which are the one output that the assignment requested. For no obvious reason you print some data to screen, which is nice, but is irrelevant for the assignment that you were actually given.
You need to read the assignment, understand what it requests, and then implement that... in fact your assignment is so clearly explained, it almost does all of your work for you:
function out = picker(cond,in1,in2);
if ???
out = ???;
else
out = ???;
end
I left you three very simple things for you to complete. (hint: use each input variable once).
2 Comments
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/471197-write-a-function-called-picker-that-takes-three-input-arguments-called-condition-in1-and-in2-in-thi#comment_776261
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/471197-write-a-function-called-picker-that-takes-three-input-arguments-called-condition-in1-and-in2-in-thi#comment_776261
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/471197-write-a-function-called-picker-that-takes-three-input-arguments-called-condition-in1-and-in2-in-thi#comment_776284
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/471197-write-a-function-called-picker-that-takes-three-input-arguments-called-condition-in1-and-in2-in-thi#comment_776284