I am stuck here, someone please help
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
49 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Abdulsalam ALMABROUK
2021 年 5 月 31 日
function out = picker(condition,in1,in2)
if condition == 1;
out = in1;
else
out = in2;
end
Ibad Ur Rahman
2022 年 4 月 4 日
function out=picker(condition,in1,in2)
if condition==1
out=in1;
else
out=in2;
end
回答 (3 件)
Chandan Kumar
2021 年 3 月 1 日
function out = picker(condition,in1,in2)
if (condition==1)
out=in1
else
out=in2
end
0 件のコメント
Nitin Kapgate
2020 年 8 月 5 日
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 件のコメント
VIGNESH B S
2021 年 10 月 13 日
function ret = picker(condition,in1,in2)
if condition == 1
ret = in1;
else
ret = in2;
end
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!