(mtrx)
¶Returns zagzig walk-off of the elements of mtrx. Essentially it walks the matrix in a Z-fashion.
mat = 1 4 7 2 5 8 3 6 9 then zagzag(mat) gives the output, [1 4 2 3 5 7 8 6 9], by walking as shown in the figure from pt 1 in that order of output. The argument mtrx should be a MxN matrix. One use of zagzig the use with picking up DCT coefficients like in the JPEG algorithm for compression.
An example of zagzig use:
mat = reshape(1:9,3,3); zagzag(mat) ans =[1 4 2 3 5 7 8 6 9]
See also: zigzag.
Package: miscellaneous