Problem 1153. Accessing elements on the diagonal
Solution Stats
Problem Comments
-
1 Comment
Richard Zapor
on 30 Dec 2012
Confused by test 6, x = [1:3;4:6;7:9;10:12]';
y_correct = [1 6 11]; I think this should be [1 5 9] as array is [1 4 7 10;2 5 8 11;3 6 9 12]
Solution Comments
-
1 Comment
Khaled Hamed
on 30 Dec 2012
Right solution to right problem
-
1 Comment
Duane Hanselman
on 30 Dec 2012
Test #5 is incorrect. Transpose on x makes the diagonal [1 5 9], [1 6 11] are not on any diagonal. #5 is the transpose of #4 and taking the transpose does not change the diagonal, unless you have some other definition for diagonal. A good solution is x(find(eye(size(x))))
-
1 Comment
Khaled Hamed
on 30 Dec 2012
Rigt solution for wrong problem
Problem Recent Solvers99
Suggested Problems
-
3264 Solvers
-
1359 Solvers
-
554 Solvers
-
334 Solvers
-
Make a vector of prime numbers
376 Solvers
More from this Author5
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!