# Using viscircles to draw circles around points.

조회 수: 84(최근 30일)
Vance Blake 2019년 8월 23일
답변: Adam Danz 2019년 8월 28일
Hello, I am trying to draw to circles using viscircles but some of the circles end up in random space instead of around the center coordiantes ive given them. Below is the code I am using to draw my circles and a picture of what is happening on the plot. Any help would be greatly appreciated
% draw exlcusion range circles b/w hormone seeds and hormone seeds
HS_kept_x = HS_kept(:, 1);
HS_kept_y = HS_kept(:, 2);
LengthHS_kept = length(HS_kept);
hold on
for i = 1:n
centers_node5 = [x(i), y(i)];
elim_circles3(i) = viscircles(centers_node5, radii_node2, 'color', 'k', 'linestyle', '--');
end
for j = 1:LengthHS_kept
centers_HS_kept = [HS_kept_x(j), HS_kept_y(j)];
elim_circles4(j) = viscircles(centers_HS_kept, radii_node2, 'color', 'k', 'linestyle', '--');
end
##### 댓글 수: 20표시숨기기 이전 댓글 수: 19
Adam Danz 2019년 8월 28일
Going line-by-line is often the best way to troubleshoot code and to really understand what's happening in the code. Well done!

댓글을 달려면 로그인하십시오.

### 채택된 답변

Adam Danz 2019년 8월 28일
Summary of the discussion in the comment section under the question:
A matrix was pre allocated incorrectly which led to indexing problems.

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by