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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 XYZ convert

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
JaapVerheggen Posted - 02/02/2009 : 08:20:37 AM
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?

---///---
1   L A T E S T    R E P L I E S    (Newest First)
eparent Posted - 02/02/2009 : 11:54:08 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000