Hello all! I have some ambiguity with MATLAB. I saved my matrix as A(:,:,1) in workspace. Now I want to access column or some entries of my big matrix on command window.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Teshome Kumsa
am 23 Aug. 2021
Kommentiert: Wan Ji
am 23 Aug. 2021
I have the following loop.
for i=1:4
A(:,:,i)=i*ones(4,4);
end
Now I want second rows of A(:,:,i) i.e second row of A(:,:,1), second row of A(:,:,2), second row of A(:,:,3) and second row of A(:,:,4).
0 Kommentare
Akzeptierte Antwort
Wan Ji
am 23 Aug. 2021
Do by following code
for i=1:4
A(:,:,i)=i*ones(4,4);
end
B = permute(A,[3,2,1]);
B(:,:,2)
The result is
ans =
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!