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
 LabTalk Forum
 plotting from different workbooks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

gatordan82

USA
7 Posts

Posted - 06/11/2010 :  4:37:46 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.0 SR6
Operating System: windows xp

I'd like to plot a graph with 6 different layers (sets of axes). I've made a template for this graph (called temp.otp) Each layer will take the data from the same column of different workbooks. I have three workbooks with a worksheet named ABC_{1,2,3}, and another three named XYZ_{1,2,3}.

Is there a good way to loop over the workbooks so that the three datasets from ABC end up on the same row, and the three from XYZ are on the other row?

I've tried doing this with the doc -e W command, but with little success.

Penn

China
644 Posts

Posted - 06/13/2010 :  05:17:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can follow the steps below.

1. Create the graph window with your template. The window command can be used.

2. Loop all workbooks in the project to add plot to the corresponding layer of the newly create graph.

2.1 Get the worksheet name by using layer object and define the data range for plotting.

2.2 Get the prefix and suffix of the worksheet name for deciding which row the data will plot. Many methods are provided for handling with string object.

2.3 Activate the corresponding layer and add plot to it, then rescale the layer.

The following code may be helpful.

	win -t p temp.otp MyPlot;  // create a graph window using template
	doc -e W  // loop all workbook in the project
	{
		string strName$ = layer.name$; // get the worksheet name
		range rr = 1!col(2);  // data range of column 2
		string strPrefix$ = strName.Left(3)$;  // get the prefix of worksheet name
		string strSuffix$ = strName.Right(1)$;  // get the suffix of worksheet name
		
		int nActive = %(strSuffix$);  // convert suffix to integer
		if(strPrefix$ == "XYZ")  // if prefix is XYZ, plot in the second row
			nActive += 3;
		
		win -a MyPlot;  // activate the graph window
		page.active = nActive;  // activate the layer for plot
		layer.include(rr);  // plot in the active layer
		layer -a;  // rescale the layer		
	}


Penn
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