I've learned from this and similar solutions of the use of shiftdim with a negative number. This may well be handy for future programming. Thanks for showing us this feature.
Select every other element of a vector
20397 Solvers
759 Solvers
276 Solvers
Sum the numbers on the main diagonal
454 Solvers
273 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!