Can I store row numbers of a matrix in a column without using any loop?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Nagesh A P
am 29 Jun. 2018
Kommentiert: Nagesh A P
am 29 Jun. 2018
How will I store the first column of a matrix as its corresponding row number without using a loop. That is, the first column for a 3x3 matrix as [1 . .;2 . .;3 . .].
2 Kommentare
Aquatris
am 29 Jun. 2018
You mean something like this;
A=[1 5 6; 2 7 8;3 9 0];
B = A(:,1); % this will make B = [1;2;3]
Akzeptierte Antwort
Nithin Banka
am 29 Jun. 2018
a = magic(3);
a(:, 1) = [1:3]; % This will store the row index in the first column of 'a'
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!