This solution is outdated. To rescore this solution, sign in.
Bravo! You are the leading solver!
I didn't know "rot90" before. I was looking for it. Thanks!
(I solved this problem with different function.)
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
n = 3;
a_correct = [0 1 2;
1 2 1;
2 1 0];
assert(isequal(rainBowMatrix(n),a_correct))
|
2 | Pass |
n = 8;
a_correct = [0 1 2 3 4 5 6 7;
1 2 3 4 5 6 7 6;
2 3 4 5 6 7 6 5;
3 4 5 6 7 6 5 4;
4 5 6 7 6 5 4 3;
5 6 7 6 5 4 3 2;
6 7 6 5 4 3 2 1;
7 6 5 4 3 2 1 0];
assert(isequal(rainBowMatrix(n),a_correct))
|
middleAsColumn: Return all but first and last element as a column vector
387 Solvers
420 Solvers
372 Solvers
07 - Common functions and indexing 4
319 Solvers
185 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!