wnr78ta 0 Newbie Poster

I am writing a m-file that simply takes in a picture of a board with 27 LEDS on it and simply tells you which LED is lit up. My problem is with the calibration of the m-file. I am trying to use [x,y] = ginput(27) to have the user click the leds on the image so that matlab knows their cooridinates, but the problem with that is when i click the LEDs I sometimes get numbers with decimals and ginput requires integers. So using floor or round I can make it an integer but doing so moves the location to far from the actual pixel so this will not work. A copy of my code is bellow any suggestions is appreciated I am just really lost on how i can fix this.

function [LEDs] = identify_LEDS
clc
clf 
close all;
clear all;
filename = 'LED_TEST3';

filename = [filename '.tif'];
imshow(filename)
m = imread(filename)';
LEDs = zeros(1,28);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---------Grid----------------
%    x1 x2 x3 x4 x5 x6 x7
%y1  1  2  3  4  5  6  7
%y2  8  9  10 11 12 13 14 
%y3  15 16 17 18 19 20 21
%y4  22 23 24 25 26 27 28
%-----------------------------
%x =[455,488,528,558,595,631,667];
%y = [387,447,503,559];
zoom(2)
[x,y] = ginput(27);
x = round(x);
y = round(y);
hold on
counter = 0;
for a = 1:4
  for b = 1:7
        counter = counter+1;
        aa = plot(x(b),y(a),'r+');
        if m(x(b),y(a)) > 200
            set(aa,'color','b') 
            LEDs(counter) = 1;

        end
    end
end
fid = fopen('data.txt', 'wt');
fprintf(fid, '%d\n', LEDs);
fclose(fid);

Thanks,
Robert