OriginPro 8 sr2
WINXP
--
I am trying to put something together in origin C so that I can convert a bunch of XYZ files (worksheets) into matrices.
Because I can't get origin C to do it since version 8, I am trying to workaround it with x-function.
This is what i got, which isn't working
void convert_matrix(string wsheet)
{
Page pg(wsheet);
Worksheet wks(wsheet);
//Create Matrix
MatrixLayer ml(); //Create a new Matrix to get the result
ml.Create();
ml.GetPage().Rename("Test");
Matrix matData(ml);
// Load the X-Function
string strXFNameToCall = "xyz_regular";
XFBase xf(strXFNameToCall);
if( !xf.IsValid() )
{
out_str("Failed to load xfunction.");
printf("This is wrong!");
return;
}
// Set arguments
if ( !xf.SetArgs(1,wks.Columns(2)) )
{
out_str("Failed to set input arguments!");
return;
}
printf("You still working?");
if ( !xf.SetArgs(2, matData) )
{
out_str("Failed to set output arguments!");
return;
}
printf("Now?");
// Execute the X-Function
if ( !xf.Evaluate())
{
out_str("Failed to execute the X-Function!");
return;
}
printf("and now?");
}
I can execute xyz_regular from the command window, and it works okay, but when I try this little macro above, I get "General Operation Failure" and Origin Crashes.
Any ideas?
---///---