Cody

# Problem 1835. Matrix to column conversion

Solution 1934806

Submitted on 13 Sep 2019 by Shiv010
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 = [10 20 30;40 50 60]; y_correct = [10; 40;20; 50; 30; 60;] assert(isequal(Mat2Vector(x),y_correct))

y_correct = 10 40 20 50 30 60 x1 = 2 y1 = 3 y = 0 0 0 0 0 0 i = 1 y = 10 0 0 0 0 0 i = 2 y = 10 40 0 0 0 0 i = 3 y = 10 40 20 0 0 0 i = 4 y = 10 40 20 50 0 0 i = 5 y = 10 40 20 50 30 0 i = 6 y = 10 40 20 50 30 60 i = 7

2   Pass
x=[-2 -4 -6; -1 -3 -5; -10 -20 0] y_correct = [-2; -1;-10; -4; -3;-20; -6;-5;0] assert(isequal(Mat2Vector(x),y_correct))

x = -2 -4 -6 -1 -3 -5 -10 -20 0 y_correct = -2 -1 -10 -4 -3 -20 -6 -5 0 x1 = 3 y1 = 3 y = 0 0 0 0 0 0 0 0 0 i = 1 y = -2 0 0 0 0 0 0 0 0 i = 2 y = -2 -1 0 0 0 0 0 0 0 i = 3 y = -2 -1 -10 0 0 0 0 0 0 i = 4 y = -2 -1 -10 -4 0 0 0 0 0 i = 5 y = -2 -1 -10 -4 -3 0 0 0 0 i = 6 y = -2 -1 -10 -4 -3 -20 0 0 0 i = 7 y = -2 -1 -10 -4 -3 -20 -6 0 0 i = 8 y = -2 -1 -10 -4 -3 -20 -6 -5 0 i = 9 y = -2 -1 -10 -4 -3 -20 -6 -5 0 i = 10

3   Pass
x=[1 2 3 4 5; 6 7 8 9 10]; x(:,:,2) = [10 20 30 40 50;60 70 80 90 100]; y_correct = [1;6;2;7;3;8;4;9;5;10;10;60;20;70;30;80;40;90;50;100] assert(isequal(Mat2Vector(x),y_correct))

y_correct = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 80 40 90 50 100 x1 = 2 y1 = 10 y = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 1 y = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 2 y = 1 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 3 y = 1 6 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 4 y = 1 6 2 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 5 y = 1 6 2 7 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 6 y = 1 6 2 7 3 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 7 y = 1 6 2 7 3 8 4 0 0 0 0 0 0 0 0 0 0 0 0 0 i = 8 y = 1 6 2 7 3 8 4 9 0 0 0 0 0 0 0 0 0 0 0 0 i = 9 y = 1 6 2 7 3 8 4 9 5 0 0 0 0 0 0 0 0 0 0 0 i = 10 y = 1 6 2 7 3 8 4 9 5 10 0 0 0 0 0 0 0 0 0 0 i = 11 y = 1 6 2 7 3 8 4 9 5 10 10 0 0 0 0 0 0 0 0 0 i = 12 y = 1 6 2 7 3 8 4 9 5 10 10 60 0 0 0 0 0 0 0 0 i = 13 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 0 0 0 0 0 0 0 i = 14 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 0 0 0 0 0 0 i = 15 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 0 0 0 0 0 i = 16 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 80 0 0 0 0 i = 17 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 80 40 0 0 0 i = 18 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 80 40 90 0 0 i = 19 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 80 40 90 50 0 i = 20 y = 1 6 2 7 3 8 4 9 5 10 10 60 20 70 30 80 40 90 50 100 i = 21