Store Output Values from All Iterations obtained by nested for loop and display minimum output and it correspond to which input values ?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Vedant Chauhan
il 17 Mar 2022
Commentato: Vedant Chauhan
il 23 Mar 2022
for c=[5 15]
for hh=[2 7]
ug=c/hh
end
end
3 Commenti
Risposta accettata
Kumar Pallav
il 21 Mar 2022
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!
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!