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
 How to access regional data range with script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

fexxor

USA
Posts

Posted - 03/10/2009 :  07:52:47 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin 8
I want to use the tool "regional data range" to select a range of data in Layer 2 of a graph, and have a script that uses that range selected to define the fitting range for data plotted in Layer 1.

How can I access the upper and lower x range selected by the regional data range selection tool? I can't find this in the manual.
Thanks!

greg

USA
1379 Posts

Posted - 03/10/2009 :  09:45:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Assuming you have only one dataset in layer 1 or the dataset you are interested in is the active dataset, and that the two layers share the same X dataset, here is one way. Run this script after setting the markers in layer 2:

mrk1=mks1; // This remembers the lower bound market 'mks1'
mrk2=mks2; // This remembers the upper bound market 'mks2'
page.active = 1;
set %C -b mrk1;
set %C -e mrk2;

After you are done fitting in layer 1 you can use the Data menu "Reset to Full Range" or execute:
set %C -b;
set %C -e;

If the X are not shared, then you must convert these indexes to X values and find corresponding X values in the other dataset. xindex finds the X equal to or less than and xindex1 finds the X equal to or greater than.

px1=xof(%C)[mks1];
px2=xof(%C)[mks2];
page.active = 2;
newx1=xindex(px1,%C);
newx2=xindex1(px2,%C);
set %C -b newx1;
set %C -e newx2;

Edited by - greg on 03/10/2009 09:58:43 AM
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