help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ginput equivalent in octave


From: Andy Adler
Subject: Re: ginput equivalent in octave
Date: Thu, 25 Sep 1997 10:37:34 -0600 (MDT)

On 11-Sep-1997, Andy Adler <address@hidden> wrote:
> I'm looking for a way to achieve the functionality of Matlab's "ginput"
> in octave. ([x,y]=ginput allows you to click on the graph and get the
> locations of the points)

To follow up my own post:

I finally got around to learning a little X programming and
wrote a *.oct file that you can dynamically load.

It takes over control of the mouse, and allows you to click
with button 1 and terminates with buttons 2 or 3.

I've put the source at 
  ftp://d201.njc.org/pub/octave/utils/ginput.cc
and a linux i386 compiled binary at
  ftp://d201.njc.org/pub/octave/utils/ginput-linux-i386.oct

here's the help:
   octave:1> help ginput
   ginput is a builtin function
   
   [...] = ginput (...)
   
   GINPUT: gets points mouse clicks on the screen
    
   [x,y]= ginput(axis)
    x -> x coordinates of the points
    y -> y coordinates of the points
   
    axis -> if specified then the first 2 (or 4) clicks
         must be on the appropriate axes. x and y (or just x
         if only 2 points specified ) will then be normalised.

   for example: x=ginput([1 10]) 
      the first two clicks should correspond to x=1 and x=10 
      subsequent clicks will then be normalized to graph units.  
   
   for example: [x,y]=ginput; 
      gives x and y in screen pixel units (upper left = 0,0 ) 

   select points with button #1. Buttons 2 and 3 quit. 


Since it links with X, you can't use mkoctfile to compile it.
The compile details are in the source.

One additional advantage of this code over Matlab's ginput
is that it can get points from anywhere on the screen. So you
can scan in graphs and get the data from clicking on the points.

_____________________________________________________________________
Andy Adler,    | Pulmonary Physiology Unit         | Lab 303-398-1626
address@hidden | National Jewish Center,Denver,USA | Fax 303-398-1607

Of making many books there is no end, and much study wearies the body.
                                                   - Ecclesiastes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]