| T O P I C R E V I E W |
| Koguma |
Posted - 04/05/2006 : 2:14:26 PM Origin Version (Origin 7.0 SR0 v7.0220(B220)): Operating System:Windows XP
Hi! I am a Brazilian student and start to program Origin C Code Builder recently.Im my code, i subtract one worksheet for another one...and integrate after that.I do 2 diferents methods : subtract method and intehrate method.I have no problems in this part of code,the methods works separately , but for to group that 2 methods , i need to save a worksheet. I know and read about LabTalk, but dont obtain sucess. My code is below and forgive me my poor English.
#include <origin.h> #include <mswin.h> #include <data.h> #include <Wksheet.h> #include <stdio.h> #include <Project.h> #include <Page.h>
int i=0,j=0; double aux1,aux2,aux3,resul;
void sub(){ Worksheet wks1(); BOOL bOK = wks1.Open("C:\Documents and Settings\CompLEVB\Meus documentos\Erick\Data1.ogw"); Worksheet wks2; BOOL bOK2 = wks2.Open("C:\Documents and Settings\CompLEVB4\Meus documentos\Erick\Data2.ogw"); wks1.AddCol("Sub"); j=wks1.GetNumRows(); for(i=0;i<wks1.GetNumRows();i++) { //subtract(i do my own code) aux1=wks1.Cell(i,1); aux2=wks2.Cell(i,1); resul=aux1-aux2; wks1.SetCell(i,2,resul); } } void integra() { string nome1=InputBox("Entre com o nome do 1º worksheet:"); Worksheet wks1(nome1); Curve cvMyCurve( "Data1_A", "Data1_Sub" ); Curve cvMyBaseline(); IntegrationResult irMyResults; wks1.AddCol("i"); Dataset dsCumIntRes( "Data1_i" ); dsCumIntRes.SetSize( cvMyCurve.GetSize() ); Curve_integrate( &cvMyCurve, &irMyResults, &cvMyBaseline, &dsCumIntRes, TRUE ); // Perform integration } This appears when i build my code : compiling... redfluo.c Linking... Done! C:\Programas cientificos\OriginC\redfluo.c(35) :Origin C Function Runtime Error, general operation failure C:\Programas cientificos\OriginC\redfluo.c(35) :Origin C Function Runtime Error, general operation failure C:\Programas cientificos\OriginC\redfluo.c(22) :Origin C Function Runtime Error, general operation failure
Please help me Thanks |
| 4 L A T E S T R E P L I E S (Newest First) |
| Koguma |
Posted - 04/25/2006 : 10:58:22 AM Thanks a lot!!! Works perfectly!  |
| Mike Buess |
Posted - 04/18/2006 : 8:28:20 PM quote: where this code goes? #ifdef salvar ... #endif
If I understand what you are trying to do then you don't need that at all. Just add this at the very end of your teste() function...
wks1.LT_execute("save -i C:\Documents and Settings\CompLevb5\Meus documentos\Erick\Data1.ogw");
Also, the only header file you need to #include is origin.h.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 04/18/2006 8:37:35 PM |
| Koguma |
Posted - 04/18/2006 : 4:04:16 PM Thanks i improved my code but i cant save the worksheet yet. where this code goes?
#ifdef salvar [Main] -i Data1.ogw #endif
and LT_execute????
Thanks for the patience!!! the code is below !!!
#include <origin.h> #include <mswin.h> #include <data.h> #include <Wksheet.h> #include <stdio.h> #include <graph.h> #include <Project.h> #include <Page.h>
void teste(){ //chama os worksheets Worksheet wks1("Data1"); BOOL bOK = wks1.Open("C:\Documents and Settings\CompLevb5\Meus documentos\Erick\Data1.ogw"); Worksheet wks2("Data2"); BOOL bOK2 = wks2.Open("C:\Documents and Settings\CompLevb5\Meus documentos\Erick\Data2.ogw"); wks1.AddCol("Sub"); //subtrai Dataset d1("Data1_B"); Dataset d2("Data2_B"); Dataset d3("Data1_Sub"); d3=d1-d2; //integra Curve cvMyCurve( "Data1_A", "Data1_Sub" ); // Create curve object to integrate Curve cvMyBaseline(); IntegrationResult irMyResults; // OriginC structure to store integration results wks1.AddCol("i"); Dataset dsCumIntRes( "Data1_i" ); // Cumulative integration result dsCumIntRes.SetSize( cvMyCurve.GetSize() ); // Set size of dsCumIntRes to size of cvMyCurve Curve_integrate( &cvMyCurve, &irMyResults, &cvMyBaseline, &dsCumIntRes, TRUE ); // Perform integration dsCumIntRes=dsCumIntRes*-1; }
|
| Mike Buess |
Posted - 04/06/2006 : 08:24:47 AM The errors were not generated during the build but rather while running one of the functions. Your first function will generate a runtime error if the second worksheet file does not exist or has fewer rows than the first. You can find out yourself which line is generating the error by double-clicking the error message... CodeBuilder will move the cursor to the offending line.
Mike Buess Origin WebRing Member |
|
|