Mark
Mark-cmd
Mark command deletes (-d) or sets a missing value (-m) to a specified dataset range. It can also manipulate masking of data points.
Syntax:
mark option dataset [range]
Options:
-d; Delete elements from dataset
Syntax: mark -d dataset [range]
Delete elements from dataset. If dataset is in a worksheet, this command deletes the specified rows (of all columns in the worksheet) from the worksheet. For example, the following script deletes row index 10 to row index 20 from the current worksheet, cell contents are shifted up:
range bb = col(2)[10:20];
mark -d bb;
To delete rows from the specified column only, use mark -dc.
-da; Ask before deleting elements from dataset
Syntax: mark -da dataset
Ask before deleting elements from dataset. Similar to the -d option, if dataset is in a worksheet, this command option will delete rows from other columns in the worksheet. For example, the following script deletes row index 10 to row index 20 in the current worksheet, after a dialog prompt:
range bb = col(2)[10:20];
mark -da bb;
-dc; Delete elements from Column Range
Syntax: mark -dc columnRange
(Origin 8) Delete elements from columnRange. This command option will not delete rows from other columns in the worksheet, which the -d option will. For example, the following script deletes row index 10 to row index 20 from col(2) only in the current worksheet, while other columns are unchanged:
range bb = col(2)[10:20];
mark -dc bb;
-m; Turn dataset elements (cells) into missing values
Syntax: mark -m dataset [range]
Turn the dataset elements (cells) into missing values. For example:
range bb = col(2)[3:6];
mark -m bb; // set col(2) row 3-6 to missing values
If the range is omitted, all cells in the dataset will become missing.
Col(dataset)=""; is equivalent to the Mark -m command without the range specification. If the cell must be set to a null (to make the cell empty), you can issue like:
for(ii=1; ii<wks.maxrows; ii++) col(2)[ii]$="";
-mc; Clear marked data
Syntax: mark -mc Dataset
Clear data that has been marked on a graph, replacing marked data with missing values.
-md; Clear all data in marked rows
Syntax: mark -md Dataset
Clear data between data markers in a graph, replacing marked data with missing values. Differs from the mark -mc option in that all worksheet rows corresponding to marked data rows are cleared.
-r; Clear all the data markers
Syntax: mark -r
Clear all data markers in a graph.
Note: We should turn the currently selected tool back to Pointer before we execute this command. For example:
dotool 0;
mark -r;
|
-s1, -s2, ... -s9;Set mask with masking value
Syntax: mark -s1, -s2, ... -s9
-s1 will set mask with masking value of 1, and -s9 will set mask with mask value of 9, while -st will toggle.
-st;Toggle mask off and on for a range of dataset
Syntax: mark -st Dataset
After a range of data has been masked in the graph using mark -w1, toggle the mask off and on for a range of dataset. For example:
range bb = col(2)[3:6];
mark -st bb; // mask off col(2) row 3-6 in current active dataset
-sw; Swap masked and unmasked points in dataset
Syntax: mark -sw dataset
Swap masked and unmasked points in dataset. For example:
mark -sw %C;
-u; Update all graphs with masked data
Syntax: mark -u
Update all graphs with masked data. Use this command after changing one of the global mask properties with the following system variables:
-
@MC |
Mask color. Follows the colors in the color palette: 1 = black, 2 = red, 3 = green, 4 = blue, etc. |
@MM |
Enable or disable mask. 0 = enable (masked points are not included in analysis). 1 = disable (masked points are included in analysis). |
@MP |
Show or hide masked data points in graph. 0 = show. 1 = hide. |
|
You can override show/hide masked points at the plot or page level:
|
-w1 or -w1u; Mask a range
Minimum Origin Version Required: 8.51 SR0
Syntax: mark -w1 [range]
Mask a range either in the worksheet or graph.
Syntax: mark -w1u [range]
Mask a range either in the worksheet or graph. This option supports undo.
When data is masked, it is automatically excluded from analysis. The '1' in -w1 and w1u is 'one'.
Note1: If no range is specified, then the command works on the active worksheet selection. You can programmatically select using the worksheet -s c1 r1 c2 r2 command.
// mask selected data
worksheet -s 1 2 1 4; // set range to rows 2 - 4 in column 1
mark -w1; // mask this range of data
// mask data range by passing column name
mark -w1u wcol(1)[10:15]; // mask rows 10 - 15 in column 1
// mask data range by passing range variable
range rr = [Book1]Sheet1!col(2); // set range to column 2
mark -w1 rr[10:30]; // mask rows 10 - 30 in column 2
// mask data block
range rBlock = wcol(2)[8]:wcol(4)[10]; // data block
mark -w1 rBlock; // mask a data block
Note2: To determine if a data point in a data plot is masked, use the following notation:
-
- datasetName<dataPointIndex> =
A return value of 0 indicates the point is not masked. 1 indicates the point is masked. For example, to determine if the fourth data point in the Book1_b data plot is masked, use:
// using dataset name
ii = Book1_b<4>;
ii = ;
// using column name
ii = [Book1]Sheet1!col(1)<3>;
ii = ;
// using range
range rr = col(2);
ii = rr<2>;
ii = ;
-wd or -wdu; Remove mask from a range
Syntax: mark -wd
Remove the mask from a range either in the worksheet or graph.
Syntax: mark -wdu
Remove the mask from a range either in the worksheet or graph. This option supports undo.
Complete Mask/Unmask example (code is destructive):
doc -s; // Shut off the Save warning flag
doc -n; // Start a new project
string strBk$ = %H;
col(1)=data(1,10);
col(2)=uniform(10);
col(3)=col(2)+.2;
plotxy (1,2:3);
string strGr$ = %H;
range rap1 = 1;
set rap1 -c 4;
win -s tv;
ty -b Data created and plotted;
win -a %(strBk$);
range ra1 = 2; // This is a worksheet range, so column = 2
mark -w1 ra1[3:8]; // range uses only rows 3 to 8
range ra2 = 3[3:8]; // This is a worksheet subrange, column 3, rows 3 to 8
mark -w1u ra2; // mask the whole subrange with undo support
ty -b Rows 3 to 8 masked in each Y column.
Graph updates to show masked points as red.
Now we will remove the mask for rows 5 and 6.;
win -a %(strGr$);
range -w ra3 = 1[5:6];
mark -wd ra3;
range -w ra4 = 2;
mark -wdu ra4[5:6];
-wtu; Toggle mask over a selected range
Syntax: mark -wtu
Toggle the mask off and on for the selected range.
-wxu; Toggle mask over a selected range, key on first cell
Syntax: mark -wxu
Toggle the mask off and on for the selected range. Differs from -wtu in that the mask state of the first cell in the range determines whether to toggle on or off. If some cells in the selected range are masked and some are not, a mask will be uniformly applied or uniformly removed, depending on the current mask state of the first cell.
-x; Create an associated X dataset
Syntax: mark -x dataset [range]
Create an associated X dataset called dataset_X, which contains whatever X values are associated with the current worksheet.
|