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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Get Points from Graph
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tekgrobi

Germany
Posts

Posted - 05/12/2004 :  09:16:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 05/12/2004 :  11:52:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/12/2004 :  2:05:13 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

tekgrobi

Germany
Posts

Posted - 05/13/2004 :  07:19:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

tekgrobi

Germany
Posts

Posted - 05/13/2004 :  09:37:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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


Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000