The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Extracting y values from graph

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Curie Posted - 01/20/2010 : 09:39:20 AM
Origin Ver. and Service Release (Select Help-->About Origin): V8 SR1
Operating System: XP (SP3)

Hi,
I want to extract the y data values from a "line graph" using e.g. the screen reader tool. I know this task should be easily achievable usign the GETPTS command but unfortunately I am not familiar writing scripts at all. Could somebody please give me a detailed explanantion on how to extract the y values of the graph into a new working sheet by double klicking onto the graph at given points ?
Thanks a lot,
Daniel
2   L A T E S T    R E P L I E S    (Newest First)
Curie Posted - 01/21/2010 : 09:20:36 AM
Thanks a lot Easwar for the very fast response and your help. I was chatting with Origin support yesterday evening and I also got a good solution for my problem.(Thanks Laurie ;) These scripts will make my work a lot easier from now on.
Daniel

For anybody who might also need this:
%W=%H;
newbook result:=strnewbook$;
win -s TV; win -a %W;
range rYOut = [strnewbook$]1!wcol(2);

dotool 2; // Start the tool

// Define the macro that runs for each point selection
def pointproc {
count++; // Increment count
rYOut[count] = y; // Get the Y coordinate
}

count = 0; // Initial point
type "Click to select point, then press Enter";
type "Press Esc or click on Pointer tool to stop";
easwar Posted - 01/20/2010 : 12:22:43 PM
Hi Daniel,

There are examples on this LabTalk Scripting Guide wiki page:
http://wiki.originlab.com/~originla/wiki/index.php?title=Script:Getting_Points_from_Graph

Version 8.1 ships with a printed form of the LabTalk Scripting Guide.

I took one of the examples from there and modified to screen reader. so in the code below, the x value at the point clicked is used, and then the y value of the active curve in the graph is found using interpolation with the %c(x) syntax. This syntax does interpolation as needed to find the y, as the x chosen can be an arbitrary value and not a point in the curve.

Easwar
OriginLab


dataset dsx, dsy;  // Create two datasets to hold the X and Y values
dotool 2;          // Start the screen reader tool
// Define the macro that runs for each point selection
def pointproc {
    count++;         // Increment count
    dsx[count] = x;  // Get the X coordinate
    dsy[count] = %c(x);  // Get the Y value of active curve using interpolation
}
 
// Define a macro that runs if user presses Esc key, 
// or clicks the Pointer Tool:
def quittoolbox {
   count=;
   for(int ii=1; ii<=count; ii++)
   {
      type $(ii), $(dsx[ii]), $(dsy[ii]);
   }
}
count = 0;  // Initial point
type "Click to select point, then press Enter";
type "Press Esc or click on Pointer tool to stop";

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000