Reading the matrix elements row wise
Show older comments
Let say I have a matrix A = [1 2 3; 4 5 6], I can access its elements by writing A(1) and A(2) etc. but this index runs column wise. How to access elements of matrix row by row, for example if I write A(2), I want to get 2 and not 4.
Accepted Answer
More Answers (1)
Paul Hoffrichter
on 30 Dec 2020
Edited: Paul Hoffrichter
on 30 Dec 2020
A = [1 2 3; 4 5 6];
Atr = transpose(A);
Atr(1:6)
ans =
1 2 3 4 5 6
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!