Saving data for each iteration of a for loop

3 次查看(过去 30 天)
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!

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-2-11
编辑:Azzi Abdelmalek 2013-2-11

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by