Drawing Rectangles/Polygons shapes with data

조회 수: 1 (최근 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 CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by