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
 Set Integration to Zero
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

grovi

Germany
1 Posts

Posted - 10/25/2017 :  07:08:52 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2016G (64bit)
Operating System: Win 7 Enterprise

Hi Guys,

I want to integrate the Values in one column (e.g. Col(B); in Col(A) are the x-Data) and write the "Integral Curve Data" (as defined in the Integ1 Function). But if a Value in one row in Col(C) is greater than 1, the integration has to start from zero.

I tried this with the following code in the "before formula script" Window:

jj=1;
for (ii = 1; ii<50 ; ii++)
{
%W = col(C)[ii]$;

if(%W>1)
  {integ1 iy:=(col(A)[jj:ii],col(B)[jj:ii]) oy:=(Col(D)[jj:ii],Col(E)[jj:ii]);
   jj=ii+1;
  }
}


But sadly only the last integration is write into Col(E), the previous are delete.

Thanks
Steffi

Edited by - grovi on 10/25/2017 07:11:13 AM

yuki_wu

896 Posts

Posted - 10/27/2017 :  01:57:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Steffi,

You can type “integ1 -d” in the Script Window to open the Integrate dialog.

You will find that you can only specify the whole XY range in Integral Curve Data item (oy) instead of the column subrange. Thus, the new result of integration will cover on the old one. As a workaround, I think you could output the result to the separate columns and then combine the columns into one.

int nrows = wks.nrows; 
jj=1;
for (ii = 1; ii <= nrows ; ii++)
{
	if( col(C)[$(ii)] > 1 )
	{
		integ1 iy:=(col(A)[jj:ii-1],col(B)[jj:ii-1]);
		jj = ii;
	}
}
integ1 iy:=(col(A)[jj:nrows],col(B)[jj:nrows]);
int ncols = wks.ncols;
for(ii = 5; ii <= ncols; ii++)
{
	copy -a col($(ii)) col(4);
}
wreducerows irng:=col(4) method:=missing;

Hope it helps.

Regards,
Yuki
OriginLab
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