Saving data for each iteration of a for loop
2 views (last 30 days)
Show older comments
I am writing a program that generates two random numbers, a random x and y value for a single point, within a for loop. This point correlates to a central value for a 5x5 pixel gaussian spot that is being added to an image. My goal is to place a large amount of these spots, without overlapping, randomly over the image, which I can currently do. However, I would then like to save the central locations of each point so I can use the same central points on another image. Right now to attempt to save the point location within my for loop I am using
A = cell(NumberOfSpots,2);
for n = 1 : 1 : NumberOfSpots;
r1 = randi(ArraySizeX-6,1,1)+3;
r2 = randi(ArraySizeY-6,1,1)+3;
A{n} = [r1,r2];
...(gaussian spot code)
end
disp(A)
which shows
A =
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
[1x2 double] []
Please help if you have any ideas on how I could fix this problem to show the point instead of 1x2 double. Thank you!
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!