MATLAB array manipulation tips and tricks
MATLAB array manipulation tips and tricks - Home - Online.no
MATLAB array manipulation tips and tricks - Home - Online.no
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CHAPTER 9. ROTATING MATRICES AND ARRAYS 269.4.5 “Outer” block rotation 90 degrees counterclockwiseGeneral caseuseTo perform the rotationX = [ A B ... [ ... ...C D ... => B D ...... ... ] A C ... ]Y = reshape( X, [ p m/p q n/q ] );Y = Y(:,:,:,n/q:-1:1);Y = permute( Y, [ 1 4 3 2 ] );Y = reshape( Y, [ p*n/q q*m/p ] );% or Y = Y(:,:,:,end:-1:1);Special case: m=pTo perform the rotationuse[ A B ... ] => [ ...BA ]Y = reshape( X, [ p q n/q ] );Y = Y(:,:,n/q:-1:1);Y = permute( Y, [ 1 3 2 ] );Y = reshape( Y, [ m*n/q q ] );% or Y = Y(:,:,end:-1:1);Special case: n=qTo perform the rotationuseX = [AB => [ A B ... ]... ]Y = reshape( X, [ p m/p q ] );Y = permute( Y, [ 1 3 2 ] );Y = reshape( Y, [ p n*m/p ] );% or Y(:,:);