Since Cody, I dislike for-loops, but your solution is way simpler than my own algorithm. Mission accomplished...
Nevertheless, I would hope for a non-looped piece of code. Let's see in phase 3.
17520 Solvers
2982 Solvers
6287 Solvers
2823 Solvers
393 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!