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
 Volume integral code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

nosrak

USA
Posts

Posted - 06/21/2007 :  4:55:26 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I need to do an integration of a matrix in x and y, exactly like the integrate function in the matrix menu:
"Origin performs a double integral over X and Y to compute the volume and reports the value in the Script window."

Can I get to this function in originC? If not any help writing the correct functions would be appreciated.
thanks

Mike Buess

USA
3037 Posts

Posted - 06/22/2007 :  08:38:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Matrix> Integrate runs the [Integrate] section of the script file Matrix.ogs. (Press Ctrl+Shift while you select a menu item and the script that executes the command will open in CodeBuilder.) You can run that script from OC code with LT_execute("run.section(Matrix,Integrate)"). If you want the complete OC code for the same thing you can use this...

int integrate_matrix()
{
MatrixLayer mm = Project.ActiveLayer();
if( !mm ) return -1;
mm.LT_execute("matrix -id");
using mat = LabTalk.mat;
mat.matname$ = mm.GetPage().GetName();
mat.integrate("ii");
double dVol;
LT_get_var("ii",&dVol);
using type = LabTalk.type;
type.BeginResults();
string str;
str.WriteLine(WRITE_OUTPUT_LOG);
str.Format("Integration of %s from zero is %g",mat.matname$,dVol);
str.WriteLine(WRITE_OUTPUT_LOG);
type.EndResults();
return 0;
}

Mike Buess
Origin WebRing Member
Go to Top of Page

nosrak

USA
Posts

Posted - 06/23/2007 :  1:27:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks that was what I needed. Next question: i'm using this to create a matrix:

MatrixPage mPage;
mPage.Create("Origin");
Matrix mat;
mat.Attach(mPage.GetName());

How do I set the coordinates of the columns and rows? I need them to be set the same as my matrix size to get the proper integral.

Edited by - nosrak on 06/23/2007 1:28:02 PM
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 06/23/2007 :  3:23:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
mat.SetXMax(maximum X value);
mat.SetXMin(minimum X value);
mat.SetYMax(maximum Y value);
mat.SetYMin(minimum Y value);

Mike Buess
Origin WebRing Member
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