Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
P = [1 0; 1 2];
m1 = eye(2);
m2 = ones(2);
M_correct = [1 0 0 0; 0 1 0 0; 1 0 1 1; 0 1 1 1];
assert(isequal(patchworkMatrix(P,m1,m2),M_correct))
M =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
|
2 | Pass |
P = 2-eye(4);
m1 = eye(2);
m2 = ones(2);
M_correct = [1 0 1 1 1 1 1 1; 0 1 1 1 1 1 1 1; 1 1 1 0 1 1 1 1; 1 1 0 1 1 1 1 1; 1 1 1 1 1 0 1 1; 1 1 1 1 0 1 1 1; 1 1 1 1 1 1 1 0; 1 1 1 1 1 1 0 1];
assert(isequal(patchworkMatrix(P,m1,m2),M_correct))
M =
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
|
3 | Pass |
P = [2 3 2 3];
m1 = 1;
m2 = 2;
m3 = 3;
M_correct = [2 3 2 3];
assert(isequal(patchworkMatrix(P,m1,m2,m3),M_correct))
M =
0 0 0 0
|
4 | Pass |
P = [6 5; 4 3; 2 1];
m1 = rand(2,3);
m2 = rand(2,3);
m3 = rand(2,3);
m4 = rand(2,3);
m5 = rand(2,3);
m6 = rand(2,3);
M_correct = [m6 m5; m4 m3; m2 m1];
assert(isequal(patchworkMatrix(P,m1,m2,m3,m4,m5,m6),M_correct))
M =
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
|
5 | Pass |
P = zeros(2);
m1 = rand(3,2);
m2 = rand(3,2);
m3 = rand(3,2);
m4 = rand(3,2);
m5 = rand(3,2);
m6 = rand(3,2);
M_correct = zeros(6,4);
assert(isequal(patchworkMatrix(P,m1,m2,m3,m4,m5,m6),M_correct))
M =
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0
|
6 | Pass |
P = [];
m = cell(100);
assert(isempty(patchworkMatrix(P,m{:})))
M =
[]
|
Test if a Number is a Palindrome without using any String Operations
157 Solvers
Create a function handle that reverses the input arguments of another function handle
118 Solvers
"Low : High - Low : High - Turn around " -- Create a subindices vector
262 Solvers
Create a matrix X, where each column is a shifted copy of the vector v
116 Solvers
Create matrix of replicated elements
266 Solvers