which one is faster for loop or switch
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Suraj Srivastava
le 9 Avr 2015
Commenté : Thomas Koelen
le 9 Avr 2015
Hi, I want to know which looping is better from programming point of view i.e. for loop or switch.
In my coding I have used switch and case , and it is taking lots of time. I am using it for optimization.
Kindly help me out in order to improve the speed of my code.
Any suggestion is appreciated.
Thanks, Suraj
1 commentaire
Stephen23
le 9 Avr 2015
Modifié(e) : Stephen23
le 9 Avr 2015
Considering one single switch or loop in isolation might not be the best way to optimize code. Upload your whole Mfile and we can see at it in context! There might be other improvements and simplifications that you have not considered, that make the switch/loop irrelevant or insignificant.
Réponse acceptée
Thomas Koelen
le 9 Avr 2015
read in the comments. (I guess you are talking about if statements and not loops)
4 commentaires
Plus de réponses (0)
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!