Cody

# Problem 43966. Matrix to 3-Column Matrix

Solution 1650647

Submitted on 17 Oct 2018 by li haitao
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
A = [1 2 3 3 4 5 6; 2 3 4 5 6 7 8]; M=[1 2 3;2 3 3;3 3 4;3 4 5;4 5 6;2 3 4;3 4 5;4 5 6;5 6 7;6 7 8] assert(isequal(matrix2matrix(A),M))

M = 1 2 3 2 3 3 3 3 4 3 4 5 4 5 6 2 3 4 3 4 5 4 5 6 5 6 7 6 7 8 [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

2   Pass
A=imread('http://www.mathworks.com/matlabcentral/profiles/3374772.jpg'); A=rgb2gray(A); A=A(1:20, 1:20); M=[192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 192;193 192 193;192 193 194;193 194 195;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 192;193 192 193;192 193 194;193 194 194;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 192;193 192 192;192 192 193;192 193 194;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 191;193 191 192;191 192 193;192 193 194;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 191;193 191 192;191 192 193;192 193 193;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 191;193 191 191;191 191 192;191 192 193;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 190;193 190 191;190 191 192;191 192 193;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 191;192 191 191;191 191 191;191 191 192;191 192 192;192 192 193;192 193 193;193 193 193;193 193 190;193 190 191;190 191 192;191 192 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 192;193 192 192;192 192 192;192 192 192;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 192;193 192 192;192 192 192;192 192 192;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;193 193 193;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 193;192 193 193;193 193 193;193 193 193;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 192;192 192 193;192 193 193;193 193 193;193 193 193;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 192;191 192 192;192 192 192;192 192 192;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 191;191 191 190;191 190 190;190 190 190;190 190 190;190 189 189;189 189 188;189 188 188;188 188 189;188 189 189;189 189 190;189 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 189 189;189 189 188;189 188 188;188 188 189;188 189 189;189 189 190;189 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;189 189 188;189 188 188;188 188 188;188 188 188;188 188 189;188 189 189;189 189 190;189 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;190 190 190;189 189 188;189 188 187;188 187 187;187 187 188;187 188 189;188 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189;189 189 189]; assert(isequal(matrix2matrix(A),M))

[Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Last element of input column does not match first element of input row. Column wins anti-diagonal conflict.] [> In hankel (line 27) In matrix2matrix>@(x)interp1(double(hankel(x,1:3)),1:length(x)-2) (line 6) In matrix2matrix (line 6) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)]

3   Pass
A = [1 2 3]; M=[1 2 3]; assert(isequal(matrix2matrix(A),M))

4   Pass
A = [1 2 3;2 3 4]; M=A; assert(isequal(matrix2matrix(A),M))

5   Pass
A = rand(1000000,3); M=A; assert(isequal(matrix2matrix(A),M))