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
 Creating new column based off another one.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bafaneh

USA
49 Posts

Posted - 10/07/2011 :  4:18:53 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.5
Operating System: w7

Hi,

I have a column, y_center plotted versus theta_offset, and y_center has negative values until a certain point, and then has only positive values.

I want to create a new column y_folded which I will then program to have plotted, which is abs(y_center) which I know how to do. However, I also want to start a new series in the same plot as soon as the data that I am taking the absolute value of changes from negative to positive, thus folding the y_center data.

Is there any easy way to have a new series start in one's plot when the values of the data I'm plotting turns positive? I think the easiest way is to use a loop, but I need help on the details.

Thanks,
Basheer

bafaneh

USA
49 Posts

Posted - 10/07/2011 :  5:21:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This is what I have so far (It is outputtign #Command error!):

//y_folded
for(ii=1; ii<=25; ii++)
{
if(col(30)[ii] > 0) break;
positive=ii;
};
win -a %(pageName$);
plotxy iy:=(33,30)[1:positive] plot:=202 ogl:=1;
plotxy iy:=(33,30)[positive:25] plot:=202 ogl:=[Graph26];
Go to Top of Page

greg

USA
1379 Posts

Posted - 10/10/2011 :  2:43:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Not sure what the
win -a %(pageName$);
is for.

As soon as you create your first plot:
plotxy iy:=(33,30)[1:positive] plot:=202 ogl:=1;
the worksheet is not longer active, so the range notation (33,30) will no longer work.

Also, I am not sure what your intention is by using [Graph26] in the second plot command. As written, that plot will go to a window named Graph26 which is not the same window as the first plot.

Here is some code that pre-declares the plot ranges, plots the first to a new window, then adds the second to that window with a different color:

// Assuming worksheet is active
range rneg = (33,30)[1:positive];
range rpos = (33,30)[positive:25];
plotxy iy:=rneg plot:=202; // ogl:=1 is the same as new graph
plotxy iy:=rpos plot:=202 ogl:=1; // same graph layer as above
range rap1 = 1; // Point to first plotted range
range rap2 = 2; // Point to second plotted range
set rap1 -c 2; // Set the negatives to red
set rap2 -c 4; // Set the positives to blue
Go to Top of Page

bafaneh

USA
49 Posts

Posted - 10/10/2011 :  2:53:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much for your response.
Go to Top of Page

bafaneh

USA
49 Posts

Posted - 10/17/2011 :  5:55:33 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Greg,

I was changing the color of the two data ranges in one of the graphs in my plotpanel which is 8 by 3. It has 24 layers, and so I set range rap1= 24 and rap2 = 25 and that didn't work. I tried making rap1 = [Graph name]24!1 and rap2 = [Graph name]24!2, but that didn't work either. However, when I was trying to change one of the middle graphs just to see how it worked, I ended up setting rap1= 5 and rap2 = 6 and it magically made the correct graph's data ranges change colors.

Could you explain this?

-Basheer
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