1

I have to write a function in Octave that creates a zigzag matrix of order n, where n is given as an input parameter of the function. The function will have the following header:

function R = zig-zag(n)

For example: zig-zag(5) should generate a matrix like this:

0   1   5   6  14
2   4   7  13  15
3   8  12  16  21
9  11  17  20  22
10 18  19  23  24

How can I write this as easy as possible in Octave?

Sardar Usama
  • 19,536
  • 9
  • 36
  • 58
dolores777
  • 11
  • 1

0 Answers0