| T O P I C R E V I E W |
| nosrak |
Posted - 06/21/2007 : 4:55:26 PM 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 |
| 3 L A T E S T R E P L I E S (Newest First) |
| Mike Buess |
Posted - 06/23/2007 : 3:23:48 PM 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 |
| nosrak |
Posted - 06/23/2007 : 1:27:25 PM 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 |
| Mike Buess |
Posted - 06/22/2007 : 08:38:41 AM 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 |