Sorry, I had put my question wrong. I have to plot a line using x and y coordinates of 2 points which are in different columns, how do I do that
how do i plot certain columns and rows of a matrix
6 次查看(过去 30 天)
显示 更早的评论
i have a matrix of 40*7 and I need to plot columns of only 3rd and 6th. How do I do it?
回答(2 个)
KSSV
2017-4-22
A = rand(40,7) ;
figure
hold on
plot(A(:,6),'r')
plot(A(:,7),'b')
legend('6th column', '7th column');
Image Analyst
2017-4-22
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 个评论
Image Analyst
2017-4-23
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!