Check out example codes for "matlab transpose image". It will help you in understanding the concepts better.

Code Example 1

% MATLAB
% swap rows and cols but keep the 3rd dimension intact.
permute(yourImg,[2 1 3]);

Learn ReactJs, React Native from akashmittal.com