Cody

Solution 468444

Submitted on 9 Jul 2014 by James
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
%% n=2; m=5; S=1:10; y_correct =[1 2 3 4 5 6 7 8 9 10]; assert(isequal(ResHape(S,m,n),y_correct))

a = 1 2 b = 1 2 3 4 5 c = 1 2 2 4 3 6 4 8 5 10 ans = 1 2 3 4 5 6 7 8 9 10

2   Pass
%% n=4; m=8; S=[1:10 6:12 5:19] y_correct=[ 1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 12 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19] assert(isequal(ResHape(S,m,n),y_correct))

S = Columns 1 through 16 1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 Columns 17 through 32 12 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 y_correct = 1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 12 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 a = 1 2 3 4 b = 1 2 3 4 5 6 7 8 c = 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 5 10 15 20 6 12 18 24 7 14 21 28 8 16 24 32 ans = 1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 12 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

3   Pass
%% n=2; m=31; S=[1:10 6:12 zeros(1,20) 5:19 ones(1,10)] y_correct=[1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 1 1 1 1 1 1 1 1 1]; assert(isequal(ResHape(S,m,n),y_correct))

S = Columns 1 through 16 1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 Columns 17 through 32 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 33 through 48 0 0 0 0 0 5 6 7 8 9 10 11 12 13 14 15 Columns 49 through 62 16 17 18 19 1 1 1 1 1 1 1 1 1 1 a = 1 2 b = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 c = 1 2 2 4 3 6 4 8 5 10 6 12 7 14 8 16 9 18 10 20 11 22 12 24 13 26 14 28 15 30 16 32 17 34 18 36 19 38 20 40 21 42 22 44 23 46 24 48 25 50 26 52 27 54 28 56 29 58 30 60 31 62 ans = 1 2 3 4 5 6 7 8 9 10 6 7 8 9 10 11 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 1 1 1 1 1 1 1 1 1

Suggested Problems

More from this Author22