Cody

Solution 318208

Submitted on 12 Sep 2013 by Sky Sartorius
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
%% x = rand(2,3,1,4); y_correct = 3; assert(isequal(ndims(remove_dims(x)),y_correct))
ans(:,:,1) = 0.4387 0.7655 0.1869 0.3816 0.7952 0.4898 ans(:,:,2) = 0.4456 0.7094 0.2760 0.6463 0.7547 0.6797 ans(:,:,3) = 0.6551 0.1190 0.9597 0.1626 0.4984 0.3404 ans(:,:,4) = 0.5853 0.7513 0.5060 0.2238 0.2551 0.6991
2   Pass
%% x = rand(2,3,4); y_correct = 3; assert(isequal(ndims(remove_dims(x)),y_correct))
ans(:,:,1) = 0.8909 0.5472 0.1493 0.9593 0.1386 0.2575 ans(:,:,2) = 0.8407 0.8143 0.9293 0.2543 0.2435 0.3500 ans(:,:,3) = 0.1966 0.6160 0.3517 0.2511 0.4733 0.8308 ans(:,:,4) = 0.5853 0.9172 0.7572 0.5497 0.2858 0.7537
3   Pass
%% x = rand(1,2,3,4,5); y_correct = 4; assert(isequal(ndims(remove_dims(x)),y_correct))
ans(:,:,1,1) = 0.3804 0.0759 0.5308 0.5678 0.0540 0.7792 ans(:,:,2,1) = 0.9340 0.5688 0.0119 0.1299 0.4694 0.3371 ans(:,:,3,1) = 0.1622 0.3112 0.1656 0.7943 0.5285 0.6020 ans(:,:,4,1) = 0.2630 0.6892 0.4505 0.6541 0.7482 0.0838 ans(:,:,1,2) = 0.2290 0.1524 0.5383 0.9133 0.8258 0.9961 ans(:,:,2,2) = 0.0782 0.1067 0.0046 0.4427 0.9619 0.7749 ans(:,:,3,2) = 0.8173 0.0844 0.2599 0.8687 0.3998 0.8001 ans(:,:,4,2) = 0.4314 0.1818 0.1455 0.9106 0.2638 0.1361 ans(:,:,1,3) = 0.8693 0.5499 0.8530 0.5797 0.1450 0.6221 ans(:,:,2,3) = 0.3510 0.4018 0.2399 0.5132 0.0760 0.1233 ans(:,:,3,3) = 0.1839 0.4173 0.9027 0.2400 0.0497 0.9448 ans(:,:,4,3) = 0.4909 0.3377 0.3692 0.4893 0.9001 0.1112 ans(:,:,1,4) = 0.7803 0.2417 0.0965 0.3897 0.4039 0.1320 ans(:,:,2,4) = 0.9421 0.5752 0.2348 0.9561 0.0598 0.3532 ans(:,:,3,4) = 0.8212 0.0430 0.6491 0.0154 0.1690 0.7317 ans(:,:,4,4) = 0.6477 0.5470 0.7447 0.4509 0.2963 0.1890 ans(:,:,1,5) = 0.6868 0.3685 0.7802 0.1835 0.6256 0.0811 ans(:,:,2,5) = 0.9294 0.4868 0.4468 0.7757 0.4359 0.3063 ans(:,:,3,5) = 0.5085 0.8176 0.6443 0.5108 0.7948 0.3786 ans(:,:,4,5) = 0.8116 0.3507 0.8759 0.5328 0.9390 0.5502