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.
Is my wife right? Now with even more wrong husband
Remove the two elements next to NaN value
Generate a NaN...on purpose
Rotate Matrix Clockwise (45 Degree)
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office