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 XYYY in different graphs
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairekun

Germany
175 Posts

Posted - 04/02/2013 :  05:44:30 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9
Operating System: Windows 7

Hello,

I have an XYYY worksheet where I want to plot graphs in different windows. I tried the follwing script:

for(int ii=2; ii<=wks.ncols; ii++) 
{
plotxy iy:=(1,$(ii))[378:632] plot:=200 ogl:=[<new>] 
}

Only one graph is plotted and I get the following error:

quote:
WKS.NCOLS: object property not found!


What am I doing wrong?

Edited by - Clairekun on 04/02/2013 05:44:53 AM

cdrozdowski111

USA
247 Posts

Posted - 04/02/2013 :  06:41:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Try this. It might not be the most efficient route but does work based on quick testing. It assumes that the workbook/worksheet you want to plot is the active one.


string strWBName$ = page.name$; // Workbook name
string strWSName$ = wks.name$; // Worksheet name
int numCols = wks.ncols; // Number of columns in active worksheet

for (int ii = 2; ii <= numCols; ii++) 
{
	// Specify full range to worksheet columns
	plotxy iy:=[%(strWBName$)]"%(strWSName$)"!(1,$(ii))[378:632] plot:=200 ogl:=[<new>]; 
}
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 04/02/2013 :  06:59:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
FYI- the reason your original script was failing was because when plotxy ran, the new graph became the active window instead of the workbook/worksheet. So the the script lost the context of the worksheet you were working from thereby causing the wks object to not be valid.

By specifying the full range to the worksheet, it doesn't have to be the active window anymore once the graphs started being created.
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 04/03/2013 :  04:39:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I understand my mistake now. It works like a charm, thanks!!
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