2.2.3.38 wcellmask

Brief Information

Mask or unmask a range of worksheet cells

Command Line Usage

wcellmask irng:=[Book1]Sheet1!Col(2)

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 irng

Input

Range

<active>
The Range to be masked.
Mask mask

Input

int

mask
Specify whether to mask or unmask the range

Option list:

  • unmask:Unmask
Unmask the selected range
  • mask:Mask
Mask the selected range

Description

This function is used to set cell(s) mask in specified range.

Examples

This script demonstrates the use of rowstats and wcellmask X-Functions to perform descriptive statistics on rows and mask the cell whose value is defined as outlier.

// create a new book and import data file
newbook sheet:=1;
string fname$ = system.path.program$ + "Samples\Graphing\Contour.dat";
impASC;
 
// get number of columns and rows
int nCols = wks.nCols;
int nRows = wks.nRows;

// turn off Spreadsheet Cell Notation firstly
page.xlcolname = 0;
// add two columns for mean and sd
wks.addCol(Mean);
wks.addCol(SD);
 
// perform row stats
rowstats -r 0 irng:=col(1)[1]:col($(nCols))[nRows] mean:=col(Mean) sd:=col(SD);
 
// mask outlier
for(int ii=1; ii<=nRows; ii++)
{
	double dLower = col(Mean)[ii]-col(SD)[ii];  // mean-sd
	double dUpper = col(Mean)[ii]+col(SD)[ii];  // mean+sd
	for(int jj=1; jj<=nCols; jj++)
	{
		double dOutlier = col($(jj))[ii];  // get cell value
		if(dOutlier<dLower || dOutlier>dUpper)
		{
			wcellmask irng:=col($(jj))[ii];  // mask the cell
		}
	}
}

For the Spreadsheet Cell Notation in the workbook, please see FAQ-849 for more information.