MATLAB: I want to traverse an array in an ‘inverse s’ order and store in a single row array is there any matlab function or code for this?eg[1 2 3; 3 4 5; 4 5 1] becomes [1,2,3,5,4,3,4,5,1]

digital image processingmatrix manipulation

[1 2 3; 3 4 5; 4 5 1]
becomes
[1,2,3,5,4,3,4,5,1]

Best Answer

>> A = [1,2,3;3,4,5;4,5,1];
>> A(2:2:end,:) = A(2:2:end,end:-1:1);
>> reshape(A',1,[])
ans =
1 2 3 5 4 3 4 5 1