Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
filetext = fileread('addVecToMat.m');
assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')
|
2 | Pass |
mat = ones(2);
v = 1:3;
comb_correct = [1 1 inf; 1 1 inf; 1 2 3];
assert(isequal(addVecToMat(mat, v), comb_correct))
m =
2
n =
2
r =
1
s =
3
a =
Inf
Inf
x =
1 1 Inf
1 1 Inf
comb =
1 1 Inf
1 1 Inf
1 2 3
|
3 | Pass |
mat = ones(3, 4);
v = [2 3];
comb_correct = [ones(3,4); 2 3 -inf -inf];
assert(isequal(addVecToMat(mat, v), comb_correct))
m =
3
n =
4
r =
1
s =
2
a =
-Inf -Inf
x =
2 3 -Inf -Inf
comb =
1 1 1 1
1 1 1 1
1 1 1 1
2 3 -Inf -Inf
|
4 | Pass |
mat = ones(2);
v = [2 3];
comb_correct = [1 1; 1 1; 2 3];
assert(isequal(addVecToMat(mat, v), comb_correct))
m =
2
n =
2
r =
1
s =
2
comb =
1 1
1 1
2 3
|
5 | Pass |
mat = ones(3);
v = 1:6;
comb_correct = [repmat([ones(1,3) inf(1,3)], 3, 1); 1:6];
assert(isequal(addVecToMat(mat, v), comb_correct))
m =
3
n =
3
r =
1
s =
6
a =
Inf Inf Inf
Inf Inf Inf
Inf Inf Inf
x =
1 1 1 Inf Inf Inf
1 1 1 Inf Inf Inf
1 1 1 Inf Inf Inf
comb =
1 1 1 Inf Inf Inf
1 1 1 Inf Inf Inf
1 1 1 Inf Inf Inf
1 2 3 4 5 6
|
28000 Solvers
Vectorize the digits of an Integer
269 Solvers
516 Solvers
583 Solvers
Remove the first, third and fifth rows of a matrix
489 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!