52 views (last 30 days)

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);

radii_node2 = 8;

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

Adam Danz
on 28 Aug 2019

Summary of the discussion in the comment section under the question:

A matrix was pre allocated incorrectly which led to indexing problems.

Opportunities for recent engineering grads.

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

Start Hunting!
## 20 Comments

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738342

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738342

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738616

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738616

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738623

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738623

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738648

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738648

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738650

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738650

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738849

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738849

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738851

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_738851

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739105

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739105

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739154

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739154

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739166

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739166

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739196

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739196

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739226

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739226

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739259

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739259

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739284

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739284

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739292

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739292

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739447

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739447

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739456

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739456

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739580

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739580

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739931

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739931

## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739948

⋮## Direct link to this comment

https://fr.mathworks.com/matlabcentral/answers/477335-using-viscircles-to-draw-circles-around-points#comment_739948

Sign in to comment.