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
 LabTalk Forum
 X-function in a 'for' loop
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Guest285

2 Posts

Posted - 05/08/2016 :  03:47:22 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.0 sr1b161
Operating System:windows
I am trying to parse a raw data file of three columns: the first two are x and y values and the third is filled with segments of 0 and 1 values.
I want to copy parts from the first two columns using the third column's values to discriminate which parts to copy.
I use a 'for' loop with the 'copydata' x-function inside, however, when i run the script the result i get is that the copydata function only executes once (although it should be executed several times).
What do i do wrong and how can i solve this problem?

jasonzhao

China
262 Posts

Posted - 05/09/2016 :  02:27:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Would you please paste your script here for test?
May be you need to active the specific windows before executing X functions by using command in the loop:

win -a BookName;


Best regards!
Jason
OriginLab Technical Service
Go to Top of Page

Guest285

2 Posts

Posted - 05/09/2016 :  03:16:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Int airtime=600;
Int basetime=120;
Int peak_num=1;
Range vv=col(N); //that the third column
For (ii=2;ii<=vv.getsize();ii++) {if (col(N)[ii]==100000&&col(N)[ii-1]==0) {copydata irng:=col(A)[ii-basetime]:col(B)[ii+airtime] orng:=R!wcol($(peak_num));peak_num+=2}}
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 05/09/2016 :  04:26:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

It seems that the script is related to some specific datasheet, would you please send your OPJ to tech@originlab.com?

Best regards!
Jason
OriginLab Technical Service
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