MATLAB: Handling text files and viewing annotations on a Picture.

annotationstext file

I have to import a text file in Matlab that contains several random numbers representing X and Y co-ordinates. Then I have to show these points on a .png picture. The text file contains 20 such points. I used "dlmread" but it makes a single matrix of all these points while I need 20 such matrices. How can I make several Matrices using that text file and how can I show these points in the Picture.?
P.S The points are like:
1428 742
256 84
986 547... etc
These points represent the pixels of a picture and I have to show them in a different color, its like darts hitting the picture but I have no idea how to do it.

Best Answer

I fail to see why you need 20 matrices when all your x,y data is in the one matrix you get from dlmread(). How about just calling dlmread() and plot(), something like this:
data = dlmread(filename, ' ');
[rows, columns] = size(data);
imshow(yourImage);
hold on;
for row = 1 : rows
randomColor = rand(1,3);
plot(data(row, 1), data(row, 2), '.', ...
'Color', randomColor, 'MarkerSize', 3);
end