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
 plotting with a loop
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Thomas M

Germany
Posts

Posted - 05/03/2005 :  10:31:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
EDIT: Sorry, wrong forum! it should be in the LabTalk Forum. Can somebody move it, or maybe somebody knows an answer at all. A LabTalk-solution would be highly prefered!

Origin Version (Select Help-->About Origin): 6.0
Operating System: w 98

Hi, I'm searching for a more elegant way to plot my data. I've a worksheet with 12 columns (xyxyxyxyxyxy) and I want to plot it into a template with 6 layers.
The following script works but is quite complicated:

win -t plot c:\2x3 %P_graph;
%R=%H;

lay -s 1;
lay -i %Q_B;
lay -a;
legend;
lay -s 2;
lay -i %Q_D;
lay -a;
legend;
lay -s 3;
lay -i %Q_F;
lay -a;
legend;
lay -s 4;
lay -i %Q_H;
lay -a;
legend;
lay -s 5;
lay -i %Q_J;
lay -a;
legend;
lay -s 6;
lay -i %Q_L;
lay -a;
legend;

with %Q containing the name of the worksheet with the data to be plotted. But what if i want to expand it to a worksheet with, lets say, 100 colomns. I don't want to plot them this way! So I've tried the following

win -t plot c:\2x3 %P_graph;
%R=%H;

loop(i,1,6)
{
lay -s $(i); //till here, everything works
k=i*2; //these two lines are my problem
lay -i %Q_$(k); //these two lines are my problem
lay -a; //from here, everything works again
legend;
};

How can i tell him to take every second row from %Q and plot it into a new layer?

Thank you,

Thomas

Edited by - Thomas M on 05/03/2005 10:36:28 AM

Mike Buess

USA
3037 Posts

Posted - 05/03/2005 :  10:45:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Thomas,

First of all, are you sure you want 100 layers in the same graph? Aside from that, the %Q_%A syntax for naming a dataset requires that %A is the column name, not column number. Try this instead...

loop(i,1,6)
{
lay -s $(i);
k=i*2;
lay -i %(%Q,k);
lay -a;
legend;
};

Mike Buess
Origin WebRing Member
Go to Top of Page

Thomas M

Germany
Posts

Posted - 05/04/2005 :  03:49:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
No, definetly not in one graph. Might be a little bit confusing. :)
But a more elegant way with a shorter script is allways prefered to me.

Thanks, it works well!
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