Q write a function called picker that takes three 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 the v
34 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Q write a function called picker that takes three 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 the value of in2 to out.
Code to call function:
- out=picker(true,1,2)
- out=picker(false,1,2)
4 comentarios
Abdulsalam ALMABROUK
el 31 de Mayo de 2021
function out = picker(condition,in1,in2)
if condition == 1;
out = in1;
else
out = in2;
end
Ibad Ur Rahman
el 4 de Abr. de 2022
function out=picker(condition,in1,in2)
if condition==1
out=in1;
else
out=in2;
end
Respuestas (3)
Chandan Kumar
el 1 de Mzo. de 2021
function out = picker(condition,in1,in2)
if (condition==1)
out=in1
else
out=in2
end
0 comentarios
Nitin Kapgate
el 5 de Ag. de 2020
Hi Vikash,
I understand that you need to write a function (“picker”) which takes three inputs and return one output based on the first argument, which is of logical type.
An answer to a similar question can be found here
0 comentarios
VIGNESH B S
el 13 de Oct. de 2021
function ret = picker(condition,in1,in2)
if condition == 1
ret = in1;
else
ret = in2;
end
end
0 comentarios
Ver también
Categorías
Más información sobre Elementary Math en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!