Problem 43737. Alternative Dimensions

Solution 1115375

Submitted on 3 Feb 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
M=ones(3,3,3); M(2,:,:)=2.*M(2,:,:); M(3,:,:)=3.*M(3,:,:); ord = [3,2,1]; MC = ones(3,3,3); MC(:,:,2)=2.*MC(:,:,2); MC(:,:,3)=3.*MC(:,:,3); assert(isequal(transform(M,ord),MC))

Error using reshape To RESHAPE the number of elements must not change. Error in transform (line 2) reshape(M,ord); Error in TestPoint1 (line 8) assert(isequal(transform(M,ord),MC))

2   Pass
M=rand(1,2,3,4,5,6); ord = [6 1 5 2 4 3]; assert(isequal(size(transform(M,ord)),ord))