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
采纳的回答
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!