This solution is outdated. To rescore this solution, sign in.
Why is this not working please?
a = ones(n,n);
for i = 1:n^2;
a(i) = i;
end
a = a'
I've tried this in school and it worked fine... :O Could you please help and explain? :)
Look closer at the requirements. Even rows should be flipped, such that their values are in descending order when reading from left-to-right.
Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
n = 5;
a = [ 1 2 3 4 5;
10 9 8 7 6;
11 12 13 14 15;
20 19 18 17 16;
21 22 23 24 25];
assert(isequal(a,back_and_forth(n)));
|
Find the sum of all the numbers of the input vector
31949 Solvers
Replace NaNs with the number that appears to its left in the row.
2018 Solvers
308 Solvers
Create matrix of replicated elements
321 Solvers
573 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!