Problem 43737. Alternative Dimensions

Solution 1076164

Submitted on 7 Dec 2016 by Peng Liu
  • Size: 12
  • This is the leading solution.
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   Pass
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))

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

Suggested Problems

More from this Author11

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!