The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 XYZ convert
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JaapVerheggen

Ireland
Posts

Posted - 02/02/2009 :  08:20:37 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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?

---///---

eparent

118 Posts

Posted - 02/02/2009 :  11:54:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Here are a couple links that may be helpful while we investigate the crash and look over your code.

The 1st link is to an Origin C XYZ Gridding example:
http://ocwiki.originlab.com/index.php?title=OriginC:XYZ_Gridding

The 2nd link shows how to call an X-Function from Origin C:
http://ocwiki.originlab.com/index.php?title=OriginC:Accessing_X-Function
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000