Welcome | spec | C-PLOT | Support | Users | Contact
 
Contents -> Writing User Functions -> Compiling user functions -> Getting and setting data points
C-PLOT Manual


E.1.11. - Getting and setting data points



In order to transfer information about a data point between your code and the overhead modules with type 4 user functions, these built-in routines are available

 Name   What it Does 
 pt_get(p, i  Fetches data point i into Point whose address is p 
 pt_set(p, i  Sets data point i from Point whose address is p 

The following code fragment sets the x and y values for 100 points. The error-bar value and line-control state only need to be set once since the same storage for the Point is reused each time.
    {
            Point   pt;             /* Declare storage */
    
            set_s(&pt, 0);          /* Error bar = 0 */
            set_down_pen(&pt);      /* Set pen down */
            for (i=0; i<100; i++) {
                    set_x(&pt, i);      /* x = i */
                    set_y(&pt, i*i);    /* y = i * i */
                    pt_set(&pt, i);     /* Set values */
            }
            set_npts(i);            /* Set number of points */
            new_points();           /* New ranges */
    }
    


  Top
  Prev | Next