Drawing Rectangles/Polygons shapes with data

2 Ansichten (letzte 30 Tage)
Chris Dan
Chris Dan am 26 Feb. 2020
Bearbeitet: KALYAN ACHARJYA am 26 Feb. 2020
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 ?

Antworten (1)

KALYAN ACHARJYA
KALYAN ACHARJYA am 26 Feb. 2020
Bearbeitet: KALYAN ACHARJYA am 26 Feb. 2020
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

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by