Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem in getting point coordinates in gui
Date: Sun, 14 Dec 2008 16:47:02 +0000 (UTC)
Organization: Loughborough University
Lines: 19
Message-ID: <gi3da6$ig9$1@fred.mathworks.com>
References: <7613d61e-d2a3-4f28-95be-428eb314332a@w24g2000prd.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229273222 18953 172.30.248.37 (14 Dec 2008 16:47:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 14 Dec 2008 16:47:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:506908


shailesh gupta <sha.gupta.88@gmail.com> wrote in message <7613d61e-d2a3-4f28-95be-428eb314332a@w24g2000prd.googlegroups.com>...
> Hi
> I am trying to make a Gui in which i load image in axes. User has to
> click anywhere in the image and i have to know where he clicked. i.e I
> want to get co-ordinates of the point of mouse-click.
> I tried it out. I am getting points without image i.e. on blank axes.
> But with image, nothing happens..
> Can anyone help me out with what to do..
> 
> thanking in advance...

It works fine for me. Check that your code is similar to this:

h=imread('image_file.jpg');
figure
image(h)
[x,y]=ginput(5)

where 5 is the number of points. if you use ginput you can take unlimited points, but the user has to press enter after the last point. also note, that you won't get the coordinates until all of the points have been taken (as far as I'm aware).