MATLAB: Which one is faster for loop or switch

for loopswitch case

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

Best Answer

read in the comments. (I guess you are talking about if statements and not loops)