How to draw a rectangle in matlab with only his center ?

25 ビュー (過去 30 日間)
Ahmed khliaa
Ahmed khliaa 2017 年 12 月 14 日
回答済み: Image Analyst 2017 年 12 月 14 日
I would like to draw a rectangle with only one informatiom which is his center . I have the coordinates X and Y of fis Center and like to draw a rectangle with specific dimesions . I would like to know if theres a function which do it

回答 (1 件)

Image Analyst
Image Analyst 2017 年 12 月 14 日
The rectangle function.
width = 100; % whatever
height = 50; % whatever...
xCenter = 400; % Wherever...
yCenter = 800; % Wherever...
xLeft = xCenter - width/2;
yBottom = yCenter - height/2;
rectangle('Position', [xLeft, yBottom, width, height], 'EdgeColor', 'b', 'FaceColor', 'r', 'LineWidth', 4);
xlim([340, 460]);
ylim([740, 860]);
grid on;

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by