how do i plot certain columns and rows of a matrix
Afficher commentaires plus anciens
i have a matrix of 40*7 and I need to plot columns of only 3rd and 6th. How do I do it?
1 commentaire
Praneeth K V
le 22 Avr 2017
Réponses (2)
KSSV
le 22 Avr 2017
A = rand(40,7) ;
figure
hold on
plot(A(:,6),'r')
plot(A(:,7),'b')
legend('6th column', '7th column');
1 commentaire
Image Analyst
le 22 Avr 2017
Replace 7 with 3 to get "only 3rd and 6th" columns.
Image Analyst
le 22 Avr 2017
Try this
line([x1, x2], [y1, y2], 'Color', 'b', 'LineWidth', 2);
where the x1 and y1 come from one column, and the x2 and y2 come from the second column. If that doesn't work, then post your data sand indicate which elements of the array you want a line drawn between.
2 commentaires
Praneeth K V
le 23 Avr 2017
Modifié(e) : Praneeth K V
le 23 Avr 2017
Image Analyst
le 23 Avr 2017
Did you see where it said the LineWidth was not a scalar and how you were passing it a string? I said to use 'LineWidth', 2 NOT 'LineWidth', '2'. Do not put the 2 in single quotes.
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!