Store Output Values from All Iterations obtained by nested for loop and display minimum output and it correspond to which input values ?
1 回表示 (過去 30 日間)
古いコメントを表示
for c=[5 15]
for hh=[2 7]
ug=c/hh
end
end
3 件のコメント
採用された回答
Kumar Pallav
2022 年 3 月 21 日
Hi,
min=10000;
for c=[5 15]
for hh=[2 7]
ug=c/hh;
if ug<min
min=ug;
cAns=c;
hhAns=hh;
end
end
end
The above code will store the minimum in variable 'min' and the corresponding inputs in 'cAns' and 'hhAns'.
Hope it helps!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!