2.2.17 mks

Brief Information

Get or add data markers for a data plot

Additional Information

X-Function not designed for Auto GetN Dialog.

Command Line Usage

1. mks sort:=0;

2. dataset begin = {2, 3}; dataset end = {4, 6}; mks ob:=begin oe:=end mode:=1;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iy

Input

XYRange

<active>
Specify the input data range to get the markers.
Beginning indices ob

Input/Output

vector

mksB
Specify the beginning indices of the data markers. The index is zero-based offset.
Ending indices oe

Input/Output

vector

mksE
Specify the ending indices of the data markers. The index is zero-based offset.
Sort by beginning indices sort

Input

int

1
When the Mode is set to get markers, this variable is used to specify whether to sort the output by beginning indices ascendingly.

Option list:

  • 1
    Sort the output indices.
  • 0
    Do not sort the output indices.
Mode mode

Input

int

0
This variable is used to set the operation mode, get markers or add markers.

Option list:

  • get:Get Markers
    Get markers, the output vectors are specified by variables ob and oe.
  • add:Add Markers
    Add markers, the beginning and ending indices are given by ob and oe respectively.

Description

This X-Function is used to get or add data markers in data plot. The beginning and ending indices of the markers are stored in two vector variables separately. The values in the vectors with the same vector index means a set of marker. When getting data markers, it allows to sort the output by the beginning indices ascendingly.

Examples

// The mks function retrieves the row indices of markers a user has added to a graph.
// These markers include those set with the Data Selector Tool and the Regional Data Selector Tool.
// Start with a new book of data and plot
newbook;
col(1) = data(1,30);
col(2) = uniform(30);
plotxy iy:=(1,2) plot:=201 color:=color(olive) size:=18;
// Run the Data Selector Tool
// You will need to position the markers and press Enter
dotool 4;

// This macro will run when you press Enter
def pointproc
{
    doTool 0;
    // BEGIN STANDALONE HERE
    dataset ID1, ID2;
    mks iy:=[%H]1!1 ob:=ID1 oe:=ID2;
    get ID1 -e end;
    %Z = Data Markers :;
    loop(ii,1,end)
    {
        %Z = %Z at $(ID1[ii]+1) to $(ID2[ii]+1);
    }
    type -b %Z;
    // END STANDALONE HERE
}

// Output instructions
type -b Move the Data Markers to any point, then press Enter. Click OK to continue with selection;
// NOTE : The row indices returned by the mks function are 0-based as in Origin C. 
// Our code reports 1-based LabTalk values by adding 1.
// To try with Regional Data Selector Tool, select several ranges and copy and run the script indicated between STANDALONE above.

Keywords:sub range, data selection, subset