Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Write a function called picker that takes three input arguments called condition, in1 and in2 in this order. The argument condition is a logical. If it is true, the function assigns the value of in1 to the output argument out, otherwise, it assigns
1 visualizzazione (ultimi 30 giorni)
Stephen23 il 11 Lug 2019
Modificato: Stephen23 il 11 Lug 2019
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);
out = ???;
out = ???;
I left you three very simple things for you to complete. (hint: use each input variable once).
Chech Joseph il 3 Set 2019
function out = picker(condition,int1,int2)
condition = int1 > int2
if condition == 1
out = int1
elseif condition == 0
out = int2
still not pasing both tests. Why?
As the assignment example explains that the user enters the arguments i.e the condition and value of in1 and in2.So,task is to write a program that can check for all conditions given by the user and produce the aprocreate output.
Roweida Bawab il 23 Mag 2020
This is how I solved it
function out = picker (condition, in1, in2)
if condition == true
out = in1;
else out = in2;
Anurag Verma il 30 Mag 2020
in1<in2 && in2>in1
this is the code that should be used and do not copy paste plz understand and do.
AYUSH MISHRA il 4 Giu 2020