ZigZag matrix with reflected format - MATLAB Cody - MATLAB Central

Problem 1636. ZigZag matrix with reflected format

Difficulty:Rate

ZigZag MATRIX with REFLECTED format.

We have only input x. We have to create a matrix in the following pattern.

 input n=5; 

then

     2     4     6     8    10
     1     3     5     7     9
     1     3     5     7     9
     2     4     6     8    10

Hint: meshgrid(1:n,1:n) & (2*i)-mod(j,n-1)+1

Solution Stats

49.48% Correct | 50.52% Incorrect
Last Solution submitted on Jun 23, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
1
3

Problem Recent Solvers255

Suggested Problems

More from this Author16

Problem Tags

Community Treasure Hunt

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

Start Hunting!