Draw an array of colored circles (i.e, "rectangles")
1 次查看(过去 30 天)
显示 更早的评论
Hello!
I would like to know if there is a simpler way to draw an array of colored circles. I have been using rectangles that have curvature to make them circles, created in a loop.
The following code draws one row of circles and then an array of several shorter rows of circles:
% Draw holes row one
for hole = 1:num_holes_row_one
x = (hole) * spacing_row_one;
y = -burden ;
rectangle('Position',[x y w h],'Curvature',[1 1],'facecolor','r');
hole_position_array(hole,:) = [x y];
end
num_holes = num_holes_rest_of_shot;
% Draw holes rest of array
hole_num = 1;
for row = 1:num_rows
for hole = 1:num_holes
this_hole_num = hole_num + num_holes_row_one;
x = ((hole-1) * spacing_rest_of_shot) + spacing_row_one;
y = -(row +1) * burden ;
if kill_me(this_hole_num) == 0
rectangle('Position',[x y w h],'Curvature',[1 1],'facecolor','r');
end
hole_position_array(this_hole_num,:) = [x y];
hole_num = hole_num + 1;
end
end
"kill_me()" is an array showing which are not to be printed. Is there a tool for multiple rectangles? Any thoughts on this are appreciated.
Doug Anderson
2 个评论
Image Analyst
2018-12-2
Please give us code that runs. What is num_holes_row_one? Also give any other variables that we'll need to run your code.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!