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
 Forum for Origin C
 Get Points 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
tekgrobi Posted - 05/12/2004 : 09:16:51 AM
I'm using Origin 7 and Origin C. I'm trying to pick Data points (Peaks) in a Graph with the getpts-command from Labtalk (for adding peaks manually).
Selecting points works fine, but it does not write the selected points into the desired Dataset.
I've already tried to modify the PointProc Macro, but without success.

Here's my code of the concerning part:
if (ynp==1)
{
LT_execute("getpts.data$ %D");
LT_execute("getpts.xData% %F");
LT_execute("getpts.indexData$ %E");
LT_execute("getpts.count %A");

string LTPT="def PointProc"
"{"
"#!type click;"
"%B = getpts.xData$;"
"%B[getpts.count] = x;"
"%B = getpts.indexData$;"
"%B[getpts.count] = index;"
"%B = %G;"
"%B[getpts.count] = y;"
//if (getpts.count >= getpts.max)
//{
//type end toolbox;
//{EndToolbox};
"type %W;"
"doTool 0;"
//}
"else "
"doTool -next;"
"}; ";

LT_execute(LTPT);
//LT_execute("PointProc");
LT_execute("getpts 10");
//LT_execute("getpts -n %G 10 ");
////////############### Wait 10 seconds to get the next graph########
LT_execute("second -p 10");
//////
LT_execute("Graph %G");
LT_execute("set %C -z 3");
LT_execute("set %G -lvc 2");
LT_execute("set %G -lvw 1");
LT_execute("set %G -l 0# ");
LT_execute("set %G -lv 1");
}

There is a for-loop including a getyesno-command, as the peak-selection has to be done for several graphs.
Maybe it can be done easier or even without using Labtalk, but I don't know :(
Thanks for your help in advance
4   L A T E S T    R E P L I E S    (Newest First)
tekgrobi Posted - 05/13/2004 : 09:37:02 AM
Now it works!!
After writing getpts.data$=%D; and not getpts.data$ %D;

Here's the code now:

#ifdef LabTalk
[LTstuff]
//type %D;
getpts 10;
getpts.data$=%D;
getpts.xData$=%F;
getpts.indexData$=%E;

def PointProc
{
#!type click;
pn=getpts.count;
%K = getpts.xData$;
%K[pn] = x;
%K = getpts.indexData$;
%K[pn] = index;
%K = %G;
%K[pn] = y;

doTool 0;
}
else
doTool -next;
};
...
#endif


tekgrobi Posted - 05/13/2004 : 07:19:43 AM
Thanks for your reply!
You're right, I should have explained better what I'd like to do and the LabTalk section is a good idea.
I have a spectrum plotted in a graph and I try to select points of the plotted dataset %D (%D is the column containing y-values).

getpts.data$ %D;

The selected points should be written into another column %F (=x) and %G (=y)of the same worksheet that includes %D.

getpts.xdata$ %F;
def PointProc
{
#!type click;
%B = getpts.xData$;
%B[getpts.count] = x;
%B = %G;
%B[getpts.count] = y;
... }


It has done right (without any defining of the PointProc) when I used the
command getpts -n %G , but I want to use the DataSelector not the ScreenReaderTool.

It still does not work, but I'll try to find the mistake.

Thanks for your help



Edited by - tekgrobi on 05/13/2004 07:20:38 AM

Edited by - tekgrobi on 05/13/2004 07:36:32 AM
Mike Buess Posted - 05/12/2004 : 2:05:13 PM
I looked closer at the getpts command and found that it redefines PointProc on execution. See this technical article for details...

Using the GETPTS command & running a script

Mike Buess
Origin WebRing Member
Mike Buess Posted - 05/12/2004 : 11:52:51 AM
Hi,

It's hard to see what you're trying to do but the code consists almost entirely LabTalk commands. It would at least be more readable if you were to create a LabTalk script section at the end of the Origin C file...

#ifdef LabTalk

[LTstuff]
getpts.data$=%D;
getpts.xData$=%F;
- more commands -

#endif LabTalk

Then call those scripts from your OC function like this...

if(ynp==1)
{
string sFile = __FILE__; // OC file path\name;
string sCmd;
sCmd.Format("run.section(%s,LTstuff)",sFile);
LT_execute(sCmd);
- more code -

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/12/2004 11:56:27 AM

Edited by - Mike Buess on 05/12/2004 12:04:16 PM

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