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
 store integration result
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

rpaczkowski

USA
Posts

Posted - 02/18/2005 :  4:06:45 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: Windows 2000

Hello everybody,

When doing an integration of x-y-values in a worksheet, the result (NOT the cumulative result) is stored in a variable called e.g.irMyResults with the command
IntegrationResult irMyResults;
Now I want to copy the integration result for every x-y-value into a column in the same worksheet of which the integration was done. By just using
printf("result = %f\n",irMyResults);
I get a general compile error.

For clarification: I really want the integration result for every x-y-pair, not the area under the whole curve.

easwar

USA
1965 Posts

Posted - 02/18/2005 :  4:32:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

IntegrationResult is a structure that holds results such as peak area, position etc. It does not contain the resulting curve at each x value. Also it cannot be just printed directly using a print statement.

You can use code such as below, which is very similar to what is in the help file:

Easwar
OriginLab


void test_integ()
{
// Point to currently active worksheet
Worksheet wks = Project.ActiveLayer();
if( !wks ) return;

// Take first two cols and use for data curve
Curve crvData(wks, 0 , 1);
// Use 3rd to place Y for output curve
Dataset dsResultCurve(wks, 2);
if( !crvData || !dsResultCurve ) return;
// Set output col length same as input curve length
dsResultCurve.SetSize(crvData.GetSize());

// Declare structure to hold integration result and call function to integrate
IntegrationResult irResult;
bool bRet = Curve_integrate(&crvData, &irResult, NULL, &dsResultCurve);
if( !bRet ) printf("error!");

// Integrated curve will be in 3rd col
// To see result values such as area, can do the following:
Tree trResult;
trResult = irResult;
out_tree(trResult);
}



Go to Top of Page

rpaczkowski

USA
Posts

Posted - 02/21/2005 :  10:00:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
easwar,

Thank you so much, that works just fine!

Ralph
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