This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = eye(2);
y_correct = [0 1; 1 0];
assert(isequal(notdiag(x),y_correct))
ans =
0 1
1 0
|
2 | Pass |
x = [4 0 0; 0 4 0; 0 0 4];
y_correct = [0 4 4; 4 0 4; 4 4 0];
assert(isequal(notdiag(x),y_correct))
ans =
0 4 4
4 0 4
4 4 0
|
3 | Pass |
x = [ -6 0 0 0; 0 -6 0 0; 0 0 -6 0; 0 0 0 -6];
y_correct = [0 -6 -6 -6; -6 0 -6 -6; -6 -6 0 -6; -6 -6 -6 0];
assert(isequal(notdiag(x),y_correct))
ans =
0 -6 -6 -6
-6 0 -6 -6
-6 -6 0 -6
-6 -6 -6 0
|
4 | Pass |
x = [100 0 0; 0 100 0; 0 0 100];
y_correct = [0 100 100; 100 0 100; 100 100 0];
assert(isequal(notdiag(x),y_correct))
ans =
0 100 100
100 0 100
100 100 0
|
579 Solvers
Check if number exists in vector
4468 Solvers
346 Solvers
273 Solvers
424 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!