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
 Separate data as cycles
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Fulerena

Spain
7 Posts

Posted - 07/03/2014 :  2:38:34 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.1 and 8.5
Operating System:Windows 7

Hi!!!
I have a problem. Sorry for the text but it's complicated to explain. I just survive programming in origin.
In my laboratory the program that gives us the data does not separate each cycle. A cycle is group of values between "x" up to "y" and return to "x". So many times. Some cycles.
Until now, x and y were constant in the cycles so I made a program which used the time as variable and it separated the cycles by ranges of increment of t. I calculated the time in the first cycle (0-t) between x-y-x and this was the first cycle, and for t-2t the second, etc.
wxt test:="col(A)[i]>=0 AND col(A)[i]<=24,75" iw:= [Book1]Sheet1 ow:=[C01]Sheet1;
My problem is, that now, the value of y change with cycles once has a value and in other cycle has a bigger one. So to reach greater potential increases the time between cycles and my program failed.
Someone would know me if you can program, for example, from the first value (line 1 in origin)to find the first maximum (line y) and copy a cycle in a column. And then the next value (line y+1) to the next maximum and then cutting and pasting cycle two in another column.
I know this is somewhat complicated to explain but if someone could help I'd appreciate it.
Thank you

greg

USA
1378 Posts

Posted - 07/03/2014 :  4:41:42 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If I understand you, your x values increase to some value, then reset to a lower value and start increasing again and that represents a cycle?
If you want to break out each cycle XY pair, you can use this script:

// BEGIN SCRIPT
range rax = 1;
wo -a 2;
target = wks.ncols - 1;
wks.col$(target).type = 4;
mark1 = 1;
lastval = rax[1];
loop(ii,2,rax.GetSize())
{
val = rax[ii];
if( val < lastval )
{
mark2 = ii - 1;
wrcopy ow:=<input> c1:=1 c2:=2 r1:=mark1 r2:=mark2 dc1:=target dr1:=1 label:=LUC format:=1;
wo -a 2;
target = wks.ncols - 1;
wks.col$(target).type = 4;
mark1 = ii;
lastval = val;
}
else lastval = val;
}
// END SCRIPT
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