Matrix (3x3 only) rotation:
3 inputs: x matrix, n times and m option.
output: y matrix with n x 45 degree rotation. m=1 for clockwise & m=2 for counterclockwise.
Solution Stats
Problem Comments
3 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers32
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15805 Solvers
-
1797 Solvers
-
290 Solvers
-
10604 Solvers
-
Rotate Matrix Clockwise (45 Degree)
38 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
I think it would be better to allow negative n instead of adding a third parameter.
There seems to be a problem with the first test case. Since we are rotating 3*45 degrees cw and 1*45 degrees ccw. The result should be 90 degrees cw (rot90(x,-1)), but it is not. And the problem description needs to be fixed: m=1 is actually n=1.
@Rafael S.T. Vieira: as Andrew Newell pointed out, it would be better to only require two parameters, with the angle (n) allowing negative input, rather than the cw/ccw parameter (m) being required for the opposite direction (m = 2). That being said, the first test case is asking for 3 * 45 degrees rotation in a clockwise (m = 1) direction. The other test case is asking for 9 * 45 degree rotation in a counter-clockwise (m = 2) direction.