Drawing Rectangles/Polygons shapes with data

2 次查看(过去 30 天)
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 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by