How can I make my function plot lines to make a rectangle?
Afficher commentaires plus anciens
Hi, I can't figure out how to make my function plot lines.
Here is my code.
clear all, format compact, format shortg; close all; fclose all; clc;
% Rectangle 1
rect1.pos= [30,20]; % x and y coordinates of the lower left corner
rect1.width = 500;
rect1.height= 400;
rect1.color = 'b';
figure(1)
draw_rect_Eduardo_Gallegos_call(rect1)
axis equal;
% Rectangle 2
rect2.pos= [350,300]; % x and y coordinates of the lower left corner
rect2.width = 220;
rect2.height= 250;
rect2.color = 'r';
draw_rect_Eduardo_Gallegos_call(rect2)
% Rectangle 3
rect3.pos= [300,250]; % x and y coordinates of the lower left corner
rect3.width = 150;
rect3.height= 400;
rect3.color = 'c';
hold on;
draw_rect_Eduardo_Gallegos_call(rect3)
Here is the function code
function [] = draw_rect_Eduardo_Gallegos_call(rect)
plot(rect.height,rect.width,'o' )
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!