Author |
Topic |
|
Scheuer
3 Posts |
Posted - 09/29/2015 : 3:15:24 PM
|
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015 G (64bit) Sr2 b9.2.272 92G Operating System: Windows 10
Hello,
I'm still a beginner in working with Origin C yet and can't find a solution for two of my problems. While trying to compile the following example, the error messages underneath always appear.
#include <GetNBox.h> #include <xfutils.h>
#include <..\OriginLab\ocPFM.h> #include <..\OriginLab\PAWizCore.h> #include <..\OriginLab\XFWizard_utils.h> #include <event_utils.h>
void opfm_tougaard_ex1(double value) { Worksheet wks = Project.ActiveLayer(); if(!wks) return; int iCol=wks.AddCol(); if(iCol<0) return; Dataset dsX(wks, 0); Dataset dsY(wks, 1); Dataset dsOut; dsOut.Attach(wks, iCol); vector vx = dsX; vector vy = dsY; int nSize; nSize=vx.GetSize(); if(nSize!=vy.GetSize()) return;
vector vTougardBaseY; vTougardBaseY.SetSize(nSize);
int iMin = 0 ; // full range int iMax = nSize-1; double dHeight = vy[0]; int nRet = opfm_tougaard(vx, vy, nSize, iMin, iMax, true, dHeight, vTougardBaseY);
dsOut.SetSize(nSize); dsOut = vTougardBaseY; }
Error messages: OriginC\Tou.c(71) :Fehler, der Funktion wurden zu wenig Argumente übergeben
OriginC\Tou.c(71) :Fehler, der Funktion wurden zu wenig Argumente übergeben
OriginC\Tou.c(71) :Fehler, allgemeiner Kompilierungsfehler
riginC\Tou.c(40) :Fehler, Fehler gefunden in Kompilierungsfunktion opfm_tougaard_ex1
Kompilierungsfehler gefunden, Verknüpfung kann nicht beginnen! " The example is supposed to calculate the parameters for the Tougaard Baseline from existing data to execute another function which actually calculates the baseline. this example was written in 2005, so maybe the problem occurs because of the newer origin version?
Aside from that, I wrote a small code in Origin C five weeks ago and it worked smoothly for several days, but when I try to run it now the following error message always appears:
vector<double> KorrekturEf(vector<double> vecIn) { vector<double> vecOut; vecOut = (vecIn * -1) + 27.193; return vecOut; }
Error message: Unbekannte Funktion: KorrekturEF(Book_1) #Command Error!
After compiling the function again (it is still saved in the same folder), I get the following error message: ungültige Argumentanzahl an Funktion übergeben : #Command Error!
I can't understand why the function should suddenly be defective (its used on the same data in the same way as before).
Best regards and thank you very much for your help!
Laura Scheuer
|
|
SeanMao
China
288 Posts |
Posted - 10/08/2015 : 02:36:56 AM
|
Hi,
We have modified the function opfm_tougaard() in our current version, the argument needed is as below:
OPFM_API int opfm_tougaard(double* pDataX, double* pDataY, UINT nSize, double dStart, double dEnd, bool base, double finalHeight, double * pOutY, bool bIndexOrEnergyInput);
You are missing one last argument: bIndexOrEnergyInput = [input] control dStart and dEnd as index input when true or as the energy input when false
before the function is: //OPFM_API int opfm_tougaard(double* pDataX, double* pDataY, UINT uDataSize, bool base, double dHeight);
For your second example,
vector<double> KorrekturEf(vector<double> vecIn) { vector<double> vecOut; vecOut = (vecIn * -1) + 27.193; return vecOut; }
You need to add that c file to Code Builder workspace before you can compile it. To add it to workspace, with that file tab active, go to menu File: Add to Workspace or use shortcut key Ctrl+W.
Regards!
Sean
OriginLab Tech. Service
|
|
|
Scheuer
3 Posts |
Posted - 11/04/2015 : 3:07:47 PM
|
Hi,
thank you very much for your help!
I could compile the first example and it calculates a baseline. But I can not get the same baseline than by using the Peak Analyzer. I think, the problem is the 'final height' parameter. Even with the same value as suggested by the auto calculation of the final height (in Peak Analyzer), the baselines were not the same. In Origin C Workspace -> Temporary folder (after using Peak Analyzer) -> pa_xpsbase.XFC I found the 'opfm_tougaard' - function, where the 'final height' parameter is named 'dBaseHeight', so maybe you modified this argument too?
Again, thank you very much for your help; I'm glad to make some progress. |
|
|
jasonzhao
China
262 Posts |
Posted - 11/05/2015 : 03:01:58 AM
|
Hello,
In Peak Analyzer tool, the XY data is transformed before executing opfm_tougaard, so the results is different from your code;
To keep the results same as PA tool, you can also transform the data in following way: 1. sort X column to make it ascending and evenly spaced; 2. interpolate the Y value based on the new X;
Then you can compare the results with PA tool again:
please refer to the code below:
void opfm_tougaard_ex1()
{
Worksheet wks = Project.ActiveLayer();
if(!wks)
return;
int iColx=wks.AddCol();
int iColy=wks.AddCol();
Dataset dsX(wks, 0);
Dataset dsY(wks, 1);
Dataset dsOutx;
Dataset dsOuty;
dsOutx.Attach(wks, iColx);
dsOuty.Attach(wks, iColy);
vector vx, vy, vX, vY;
vx = dsX;
vy = dsY;
int nSize;
nSize=vx.GetSize();
double xmin, xmax;
vx.GetMinMax(xmin, xmax);
vX.Data(xmin, xmax, (xmax-xmin)/(nSize-1)); //interpolate to make X column ascending and evenly spaced.
vY.SetSize(nSize);
ocmath_interpolate(vX, vY, nSize, vx, vy, nSize,INTERP_TYPE_LINEAR);
vector vTougardBaseY;
vTougardBaseY.SetSize(nSize);
int iMin = 0 ; // full range
int iMax = nSize-1;
double dHeight =vY[0];
int nRet = opfm_tougaard(vX, vY, nSize, iMin, iMax, true, dHeight, vTougardBaseY, true);
dsOuty.SetSize(nSize);
dsOuty = vTougardBaseY;
dsOutx=vX;
}
Best regards! Jason OriginLab Technical Service
|
Edited by - jasonzhao on 11/05/2015 03:04:07 AM |
|
|
Scheuer
3 Posts |
Posted - 11/05/2015 : 11:30:39 AM
|
Hey, it works now. Thank you very much for your help! I tried to correct the example for so long and failed evertime. I'm so happy that it finally works.
Thank you and best regards, Laura |
|
|
|
Topic |
|
|
|