T O P I C R E V I E W |
altertoby |
Posted - 03/05/2010 : 08:17:32 AM Origin Ver.: OriginPro 8 SR 0 Operating System: Win7 64
Is there a way to specify the "recalculate" - option in OriginC when calling a xf? In LabTalk something like interp1xy iy:=Col(2) method:=spline npts:=50 -r 1 works like a charm, but I can't find a method of doing this from OriginC.
I find two promising method-signatures in XFBase: int ExecuteLabTalk(LPCSTR lpcszArgs, vector<string>* pvsVarValues, LPVOID lpRetData = NULL, int nRetDataXVT = XVT_INT, int* lpOCerr = NULL, DWORD dwCntrl = 0, int nRecalculate = AU_NONE);
and BOOL Run(int nAutoUpdate, TreeNode& trGetN = NULL, LPVOID lpRetData = NULL, int nRetDataXVT = XVT_INT, int* lpOCerr = NULL, DWORD dwCntrl = 0);
But the first method only accept a LabTalk-string (and I want to use the SetArg-Method -> So is there a way to generate the string after setting up the XFBase-object properly?) and the second method just don't register the recalculation-option. So how to do it? Thanks |
4 L A T E S T R E P L I E S (Newest First) |
folger |
Posted - 03/28/2010 : 8:39:49 PM Hi Tobias:
The previous code did not work because trGetN is not correctly obtained. I change a little to make it work now, please check below :
#include <..\originlab\XFunctionEx.h>
void testXFOp()
{
Worksheet wks;
wks.Create();
wks.SetSize(-1, 4);
vectorbase& vx = wks.Columns(0).GetDataObject();
vectorbase& vy = wks.Columns(1).GetDataObject();
vx.Data(1, 32);
vy.Data(1, 32);
XFunction xf;
Tree trXF;
if ( !xf.Load(&trXF, "integ1", 0, true, false, true) )
return;
XYRange xyIn;
xyIn.Add(wks, 0, "X");
xyIn.Add(wks, 1, "Y");
xf.SetArg("iy", xyIn);
XYRange xyOut;
xyOut.Add(wks, 2, "X");
xyOut.Add(wks, 3, "Y");
xf.SetArg("oy", xyOut);
Tree tr;
TreeNode trGetN;
if ( !xf.GetGUI(tr, trGetN) )
return;
xf.Run(AU_AUTO, trGetN);
}
Seems you are using 80SR0, after running this code then change parameter to open dialog, you will see the input data is still displayed incorrectly as "([Book2]Sheet1!A,[Book2]Sheet1!B,<active>)". This is a known bug and fixed in SR2. However, you can go on changing some options and it will work fine with this "wrong" input data.
We highly recommend you to upgrade to 80SR6, which includes many others improvements and fixes :
http://wiki.originlab.com/~originla/wiki/index.php?title=Release_Notes
Originlab Corp. There is always something |
altertoby |
Posted - 03/27/2010 : 11:56:46 AM Thanks folger for your help. But apparently the code you provided does not work.
There is now the symbol for auto-recalculation, but if I open the "change parameter"-dialog wrong data is shown. In your example eg. the y-data is set to the created x-column and so the recalculation does not work either.
Any idea? |
folger |
Posted - 03/12/2010 : 05:56:21 AM We support calling XF with recalculate from OC since 80SR0, you can try the OC sample code about calling XF integ1 :
#include <..\originlab\XFunctionEx.h>
void testXFOp()
{
Worksheet wks;
wks.Create();
wks.SetSize(-1, 4);
vectorbase& vx = wks.Columns(0).GetDataObject();
vectorbase& vy = wks.Columns(1).GetDataObject();
vx.Data(1, 32);
vy.Data(1, 32);
XFunction xf;
Tree trXF;
Tree trGetN;
if ( !xf.Load(&trXF, "integ1", 0, true, false, true, trGetN) )
return;
XYRange xyIn;
xyIn.Add(wks, 0, "X");
xyIn.Add(wks, 1, "Y");
xf.SetArg("iy", xyIn);
XYRange xyOut;
xyOut.Add(wks, 2, "X");
xyOut.Add(wks, 3, "Y");
xf.SetArg("oy", xyOut);
xf.Run(AU_AUTO, trGetN);
}
Originlab Corp. There is always something |
Iris_Bai |
Posted - 03/08/2010 : 9:14:33 PM Hi,
We did not support this in Origin C. I submitted a tracker item #15183 to implement this feature.
Thanks your report.
Iris |
|
|