Plotting Two Consecutive Columns of Matrices
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Femi O. Jinadu
am 21 Dez. 2021
Kommentiert: Star Strider
am 21 Dez. 2021
Hi,
I have 4 x 202 matrix, and I want to plot the columns in 2's e.g columns 1 and 2, next columns 3 and 4 as they represent X and Y coordinates. How can I do this?
Thanks
0 Kommentare
Akzeptierte Antwort
Star Strider
am 21 Dez. 2021
First a (4 x 202) matrix defines a matrix of 4 rows and 202 columns. Assuming that it’s actually a (202 x 4) matrix, perhaps something like this —
M = randn(15, 4) % Prototype
Mr = reshape(M, [], 2)
figure
plot(Mr(:,1), Mr(:,2), '.')
If the matrix actually is (4 x 202), transpose it first, then use the approach in this code example.
.
8 Kommentare
Star Strider
am 21 Dez. 2021
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Weitere Antworten (1)
Chunru
am 21 Dez. 2021
x = rand(202, 4); % 202x4 (not 4x202)
plot(x(:,1), x(:, 2), 'ro', x(:,3), x(:, 4), 'b*')
0 Kommentare
Siehe auch
Kategorien
Mehr zu Annotations 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!