Conditional statement in a for/if loop
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Fraje Watson
le 6 Juin 2019
Commenté : Fraje Watson
le 7 Juin 2019
Hi,
I'm trying to write a loop with 5 variables. Here's what I want to do in words, but can't make my code work
for every value of Frame
if LBOS > RBOS
give LDSM
else give RDSM
I'd like the results to be displayed in a table alongside the associated Frame value. I hope that makes sense.
Thanks very much!
1 commentaire
Réponse acceptée
Alex Mcaulley
le 7 Juin 2019
Try this:
res = RDSM;
res(LBOS > RBOS) = LDSM(LBOS > RBOS);
T2 = table(frame,res);
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!