Unfold a 2-D matrix to a 1-D array in zig-zag order, e.g., for matrix

 [ 1 2 3 ;
   4 5 6 ;
   7 8 9 ] 

the resulting 1-D array should be

 [ 1 2 4 7 5 3 6 8 9 ]

Solution Stats

1265 Solutions

345 Solvers

Last Solution submitted on Jan 29, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers345

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!