Drawing Rectangles/Polygons shapes with data

3 ビュー (過去 30 日間)
Chris Dan
Chris Dan 2020 年 2 月 26 日
編集済み: KALYAN ACHARJYA 2020 年 2 月 26 日
Hello, I have this data
the first column is the start and end points of the rectangle and the height of the rectangle is the second column - third column is at that point.
The code which I am using to plot it is this
for i =1:1:1
MD(:,1) = MD(:,1)
a = size(MD,1);
for j =1:1:(a-1)
coord = MD(j:j+1,:);
rectangle('Position',[coord(1,1) 0 coord(2,1)-coord(1,1) coord(1,2)-coord(1,3)])
axis([0 0.2 -0.1 0.2])
hold on
end
end
It is not working,
does anybody knows ?

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 2 月 26 日
編集済み: KALYAN ACHARJYA 2020 年 2 月 26 日
I think, one for loop is sufficients
%Read the file xlsx or CSV
for loop to read the individual row
row_data=data; % Please ensure mat /array
figure,
data=[0,0.0480,0.0380]
rectangle('Position',[data,data(3)]);
%.............................^ set this points as approprite
axis([0 0.09 0 0.9]); % Set the axes positions, so that small ractangle also visible
hold on;
end

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by