フィルターのクリア

how to plot rectangles from csv data

1 回表示 (過去 30 日間)
vishnu
vishnu 2019 年 1 月 14 日
編集済み: vishnu 2023 年 4 月 9 日
%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 件のコメント
Walter Roberson
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)
KSSV
KSSV 2019 年 1 月 15 日
編集済み: KSSV 2019 年 1 月 15 日
It depends on how the data is arranged in your csv file. Attach your csv file.
Alos try
plot(m',n')

サインインしてコメントする。

採用された回答

KSSV
KSSV 2019 年 1 月 15 日
A = [1 31
4 9
12 56
17 12
47 43
56 45
43 25
50 14] ;
R = 1 ;
th = linspace(0,2*pi) ;
x = R*cos(th) ;
y = R*sin(th) ;
figure
hold on
for i = 1:size(A,1)
xc = A(i,1)+x ;
yc = A(i,2)+y ;
plot(xc,yc) ;
end
  1 件のコメント
vishnu
vishnu 2019 年 1 月 15 日
編集済み: vishnu 2019 年 1 月 15 日
thank you all, especially to mr KSSV, it works well now with simple for loop i = 1:size(A,1)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by