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
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; }