rot90 in 3D

This function extends the rot90 command to 3D.
1.4K Downloads
Updated 4 Nov 2009

View License

This function extends the rot90 command to 3D. So you can rotate a 3D matrix by 90degrees about the x-axis, y-axis, or z-axis. It is kind of hard to visualize in your head but I am pretty sure it works correctly. There is a test matrix included in the comments for the file.

Cite As

Matt Fetterman (2026). rot90 in 3D (https://www.mathworks.com/matlabcentral/fileexchange/25546-rot90-in-3d), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Creating and Concatenating Matrices in Help Center and MATLAB Answers
Tags Add Tags
Version Published Release Notes
1.4.0.0

Thanks to Jan for sending me this corrected version !

1.3.0.0

updated as suggested by Jan Simon. Makes it faster by removing loops !

1.2.0.0

I corrected the description to clarify that it rotates about x, y, or z-axis.

1.1.0.0

In the comments, the test matrix smoki was not as I had intended.

1.0.0.0