how to plot rectangles from csv data
显示 更早的评论
%hi,
%how to plot rectangles from csv files? This code does read the csv file
Array=csvread('dataxyz.csv');
n = Array(:, 1);
m = Array(:, 2);
plot(m, n)
%but it doesnt work
c = [n m];disp(c);
pos = [c-R*0.5 R R];
r = rectangle('Position',pos,'Curvature',[1 1], 'FaceColor', 'black', 'Edgecolor','none')
%thankyou
3 个评论
Bob Thompson
2019-1-14
Can you elaborate more on what exactly isn't working? Are you getting some kind of error message? Is it not producing rectangles for you? Is it producing rectangles of the wrong size? Is it producing rectangles in the wrong locations?
Walter Roberson
2019-1-15
Each call to rectangle() draws exactly one rectangle. You cannot get rectangle to draw multiple rectangles in a single call.
Hint:
x = [x1 x2 x2 x1 x1 nan x3 x4 x4 x3 x3 nan ...]
y = [y1 y1 y2 y2 y1 nan y3 y3 y4 y4 y3 nan ...]
plot(x, y)
It depends on how the data is arranged in your csv file. Attach your csv file.
Alos try
plot(m',n')
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!