Saving data for each iteration of a for loop

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 投票

cell2mat((A)

1 件のコメント

Jason
Jason 2013 年 2 月 11 日
Thank you! Works perfect

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by