Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ginput problem

Subject: ginput problem

From: Michael Spurr

Date: 10 Dec, 2008 11:09:02

Message: 1 of 10

I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:

Error in ==> ginput at 99
keydown = wfbp;

Error in ==> plot_sample at 17
[X,Y] = ginput;

Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?

Many thanks,

Michael

Subject: ginput problem

From: Dave Brackett

Date: 14 Dec, 2008 21:08:02

Message: 2 of 10

"Michael Spurr" <michael.spurr@nospam.selexgalileo.com> wrote in message <gho80e$bv2$1@fred.mathworks.com>...
> I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:
>
> Error in ==> ginput at 99
> keydown = wfbp;
>
> Error in ==> plot_sample at 17
> [X,Y] = ginput;
>
> Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?
>
> Many thanks,
>
> Michael

can you post your code? the error message doesn't say much and has probably only been displayed because of the forced exiting of the function using ctrl+c.

have you tried using ginput with a set number of points as a test? e.g. [x,y]=ginput(2)

Subject: ginput problem

From: Michael Spurr

Date: 15 Dec, 2008 08:34:02

Message: 3 of 10

This is highly embarassing, but it turns out I was pressing 'return' on the wrong window! I was doing it on the Matlab window rather than the image window. It appears that my brain is already shutting down for the Christmas period!

Thanks for the advice and sorry about the waste of time.

Michael

Subject: ginput problem

From: Yagnaseni Roy

Date: 12 Nov, 2011 03:30:14

Message: 4 of 10

"Michael Spurr" <michael.spurr@nospam.selexgalileo.com> wrote in message <gi54pq$gin$1@fred.mathworks.com>...
> This is highly embarassing, but it turns out I was pressing 'return' on the wrong window! I was doing it on the Matlab window rather than the image window. It appears that my brain is already shutting down for the Christmas period!
>
> Thanks for the advice and sorry about the waste of time.
>
> Michael

glad to know your problem got sorted...

On the other hand, I'm trying to plot all the data points that I selected using ginput at once on a single plot....

I tried:

M = mmreader('fractogene.avi');
    N = M.NumberOfFrames;
    for ii = 1:N
   image(M.read(ii));
   [X,Y]=ginput(1);
   pause(0.1)
    end

THEN TO GET THE PLOT, I TRIED:

for ii=1:N
plot(X,Y)
end

BUT IT JUST GIVE ONE SINGLE POINT AS THE OUTPUT...I dont get the N data points that I'm supposed to...
Please tell me what's wrong!

Subject: ginput problem

From: TideMan

Date: 12 Nov, 2011 09:08:33

Message: 5 of 10

On Nov 12, 4:30 pm, "Yagnaseni Roy" <y...@mit.edu> wrote:
> "Michael Spurr" <michael.sp...@nospam.selexgalileo.com> wrote in message <gi54pq$gi...@fred.mathworks.com>...
> > This is highly embarassing, but it turns out I was pressing 'return' on the wrong window! I was doing it on the Matlab window rather than the image window. It appears that my brain is already shutting down for the Christmas period!
>
> > Thanks for the advice and sorry about the waste of time.
>
> > Michael
>
> glad to know your problem got sorted...
>
> On the other hand, I'm trying to plot all the data points that I selected using ginput at once on a single plot....
>
> I tried:
>
> M = mmreader('fractogene.avi');
>     N = M.NumberOfFrames;
>     for ii = 1:N
>    image(M.read(ii));
>    [X,Y]=ginput(1);
>    pause(0.1)
>     end
>
> THEN TO GET THE PLOT, I TRIED:
>
> for ii=1:N
> plot(X,Y)
> end
>
> BUT IT JUST GIVE ONE SINGLE POINT AS THE OUTPUT...I dont get the N data points that I'm supposed to...
> Please tell me what's wrong!

You need to read Getting Started in Help.
In particular, look at defining vectors and using a for loop.

Subject: ginput problem

From: Yagnaseni Roy

Date: 12 Nov, 2011 17:24:11

Message: 6 of 10

"Michael Spurr" <michael.spurr@nospam.selexgalileo.com> wrote in message <gho80e$bv2$1@fred.mathworks.com>...
> I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:
>
> Error in ==> ginput at 99
> keydown = wfbp;
>
> Error in ==> plot_sample at 17
> [X,Y] = ginput;
>
> Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?
>
> Many thanks,
>
> Michael

Could you be more specific to what exactly the problem is? With what you said, I'm not too far from where I started!

Subject: ginput problem

From: Yagnaseni Roy

Date: 12 Nov, 2011 18:15:14

Message: 7 of 10

"Yagnaseni Roy" <yroy@mit.edu> wrote in message <j9ma3r$mu6$1@newscl01ah.mathworks.com>...
> "Michael Spurr" <michael.spurr@nospam.selexgalileo.com> wrote in message <gho80e$bv2$1@fred.mathworks.com>...
> > I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:
> >
> > Error in ==> ginput at 99
> > keydown = wfbp;
> >
> > Error in ==> plot_sample at 17
> > [X,Y] = ginput;
> >
> > Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?
> >
> > Many thanks,
> >
> > Michael
>
> Could you be more specific to what exactly the problem is? With what you said, I'm not too far from where I started!

ITS OK,I modified my for loop and I got my desired results:

for ii= 1:N
       hold on
       plot(x(ii),y(ii),'ro')
       hold off
   end

thanks.

Subject: ginput problem

From: TideMan

Date: 12 Nov, 2011 19:49:51

Message: 8 of 10

On Nov 13, 7:15 am, "Yagnaseni Roy" <y...@mit.edu> wrote:
> "Yagnaseni Roy" <y...@mit.edu> wrote in message <j9ma3r$mu...@newscl01ah.mathworks.com>...
> > "Michael Spurr" <michael.sp...@nospam.selexgalileo.com> wrote in message <gho80e$bv...@fred.mathworks.com>...
> > > I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:
>
> > > Error in ==> ginput at 99
> > >       keydown = wfbp;
>
> > > Error in ==> plot_sample at 17
> > > [X,Y] = ginput;
>
> > > Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?
>
> > > Many thanks,
>
> > > Michael
>
> > Could you be more specific to what exactly the problem is? With what you said, I'm not too far from where I started!
>
> ITS OK,I modified my for loop and I got my desired results:
>
> for ii= 1:N
>        hold on
>        plot(x(ii),y(ii),'ro')
>        hold off
>    end
>
> thanks.

But you don't need a loop for this.
Just
plot(x,y,'ro')
will do.

Once again I suggest you read Getting Started.

Subject: ginput problem

From: Yagnaseni Roy

Date: 12 Nov, 2011 19:53:10

Message: 9 of 10

"Yagnaseni Roy" <yroy@mit.edu> wrote in message <j9md3i$279$1@newscl01ah.mathworks.com>...
> "Yagnaseni Roy" <yroy@mit.edu> wrote in message <j9ma3r$mu6$1@newscl01ah.mathworks.com>...
> > "Michael Spurr" <michael.spurr@nospam.selexgalileo.com> wrote in message <gho80e$bv2$1@fred.mathworks.com>...
> > > I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:
> > >
> > > Error in ==> ginput at 99
> > > keydown = wfbp;
> > >
> > > Error in ==> plot_sample at 17
> > > [X,Y] = ginput;
> > >
> > > Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?
> > >
> > > Many thanks,
> > >
> > > Michael
> >
> > Could you be more specific to what exactly the problem is? With what you said, I'm not too far from where I started!
>
> ITS OK,I modified my for loop and I got my desired results:
>
> for ii= 1:N
> hold on
> plot(x(ii),y(ii),'ro')
> hold off
> end
>
> thanks.

I'M SORRY TO BE ADDING A trivial post, but I'm new to MATLAB and I need to know what options matlab's huger resource has for me....
I'm basically trying to plot the positions and velocity of a cell as it moves from frame to frame in a video. The problem is that the video has tremendous background noise and its hard to locate the cell.

So using ginput serves my purpose, though it takes up a lot of time and manual input. So is there any other function that might suit my situation?

I've already split my video into its frames, and u can see some of the frames on:

http://imgur.com/D60kG
http://imgur.com/4Yvy5
http://imgur.com/D60kG
http://imgur.com/TvSNv

Subject: ginput problem

From: Yagnaseni Roy

Date: 12 Nov, 2011 21:28:11

Message: 10 of 10

TideMan <mulgor@gmail.com> wrote in message <d3533eca-f345-4cfe-a078-036aba2803dc@h5g2000yqk.googlegroups.com>...
> On Nov 13, 7:15 am, "Yagnaseni Roy" <y...@mit.edu> wrote:
> > "Yagnaseni Roy" <y...@mit.edu> wrote in message <j9ma3r$mu...@newscl01ah.mathworks.com>...
> > > "Michael Spurr" <michael.sp...@nospam.selexgalileo.com> wrote in message <gho80e$bv...@fred.mathworks.com>...
> > > > I'm having trouble with the ginput command. I use it in a program to extract data points from a graph displayed on screen by clicking the mouse on the axes and plot. Previously, this program and ginput worked without any problem. However, just today I tried to use the program again and nothing happened after the first use of ginput. I selected the points on the plot and pressed return, after which Matlab displayed the 'busy' status indicator but did not move on to the next part of the program. When forcing the program to stop through control-c, I got the following message:
> >
> > > > Error in ==> ginput at 99
> > > >       keydown = wfbp;
> >
> > > > Error in ==> plot_sample at 17
> > > > [X,Y] = ginput;
> >
> > > > Has anyone come across this problem? Any idea why ginput has suddenly stopped working for me?
> >
> > > > Many thanks,
> >
> > > > Michael
> >
> > > Could you be more specific to what exactly the problem is? With what you said, I'm not too far from where I started!
> >
> > ITS OK,I modified my for loop and I got my desired results:
> >
> > for ii= 1:N
> >        hold on
> >        plot(x(ii),y(ii),'ro')
> >        hold off
> >    end
> >
> > thanks.
>
> But you don't need a loop for this.
> Just
> plot(x,y,'ro')
> will do.
>
> Once again I suggest you read Getting Started.

ACTUALLY, I'm doing it for a video, and I need it to apply to all the frames, so I do need a loop..

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us