LabTalk Improvements
- 1 Range Notation Improvements
- 2 Substitution Notation Improvement (ORG-9221)
- 3 Create and plot a named range via virtual dataset (ORG-3423 )
- 4 LabTalk Callable OC function to Execute an Operation (ORG-7877)
- 5 Improve LabTalk "type -gb" command for text file output (ORG-8306)
- 6 Better error checking in LabTalk function (ORG-9155)
- 7 LT access to user color increment list (ORG-8942)
- 8 Labtalk Function to Generate Patterned Data (ORG-7900)
- 9 Layer (command) Supports Subrange (ORG-2940)
- 10 New System Variables
- 11 New LT Objects/Properties/Methods
- 12 LT command to list number of DataRange (ORG-7522)
- 13 Provide Tooltip for any object with Script, Run After set (ORG-8882)
Range Notation Improvements
Virtual Dataset for a Block of Cells (ORG-8226)
//Import a sample data into a new book
fname$=system.path.program$ + "\Samples\Matrix Conversion and Gridding\DirectXY.dat";
newbook;
impasc;
//Define the first row (from column B to E) as the first block
range -v r1=B[1]:E[1];
//Define the first column (from row 2 to 6) as the second block
range -v r2=A[2:6];
//Assign the values in the first block to the second block
r2=r1;
Preserve Double Quotes (ORG-8267)
range r1 = 1!; //First sheet in the activated workbook
range r2 = "1!"; //Column with long name "1!"Substitution Notation Improvement (ORG-9221)
@option | Substitute Text From... |
|---|---|
@LD"name" | The user-defined parameter with the specified name. |
Create and plot a named range via virtual dataset (ORG-3423 )
Syntax: create name -nrs extract_rule [range_string, designation, scope_range_string]
Value | Meaning |
|---|---|
0 | Concatenate by column. Combine the values in a selected block of cells through column direction. |
1 | Concatenate by row. Combine the values in a selected block of cells through row direction. |
2 | Mean of row. Use the mean value of each row in selection. |
3 | SD of row. Use the standard deviation of each row in selection. |
4 | Even rows. Use the values in the even rows of selection. |
5 | Odd rows. Use the values in the odd rows of selection. |
//Plot a graph with 1st row of worksheet as X, 2nd row of worksheet as Y
create myvsx -nrs 1 "[Book1]Sheet1![1]:[1]";//Create a virtual dataset myvsx from 1st row of Book1 Sheet1
create myvsy -nrs 1 "[Book1]Sheet1![2]:[2]";//Create a virtual dataset myvsy from 2nd row of Book1 Sheet1
plotxy (myvsx, myvsy);//Plot a graph, using myvsx as X and myvsy as Y//Plot a box chart from a block of cells
create myvsbox -nrs 1 "[Book1]Sheet1!1[2]:3[4]"; //Create a virtual dataset myvsbox from a block of cells
win -t p box; //Create a black graph window with box chart template
layer -i206 myvsbox;//Add virtual dataset myvsbox to the graphLabTalk Callable OC function to Execute an Operation (ORG-7877)
Click on the recalculate lock and select Show Info from the context menu to get the "operation_uid", then run execute_operation function.
execute_operation(operation_uid);Improve LabTalk "type -gb" command for text file output (ORG-8306)
type -gb [[e][f][r/n]] fileName;Option | Description |
|---|---|
e | Output to new empty file, if not specified then text is appended. Will erase existing one. |
f | Output to file only, no output to script window. |
n | Output LF for end-of-line. |
r | Output CR for end-of-line. |
Neither n nor r specified | Output CRLF for end-of-line. |
New line is \r\n by default, n = use \n as new line, r = use \r as new line.
Better error checking in LabTalk function (ORG-9155)
In an OGS file, add the following script, and then run the main section, the error message will go to Message Log.
[Main]
Function int aa(int nn)
{
ty "inside function";
sdf;//error
return 1;
}
int nErr = aa(0);
ty "after function";LT access to user color increment list (ORG-8942)
LabTalk can now get or set in the same command area as set/get data plot colors. The syntax is:
set %C -cue bval; //set custom list enable
get %C -cue bval; //get custom list enable
Sample:
newbook;
col(A) = data(1,12);
col(B) = col(A);
plotxy (1,2);
set %c -ci 1;
set %c -cue 1;
set %c -cu 2 4 6 8;
dataset ds;
get %c -cu ds;Labtalk Function to Generate Patterned Data (ORG-7900)
To generate numeric data:
col(A)=pattern(1,10,2,2,3); // from, to, inc, value repeat count, sequence repeat countTo generate string data:
stringarray sa;
sa.Add("NY");
sa.Add("MA");
col(B)=pattern(sa, 2, 3); // string sources, value repeat count, sequence repeat count
//can also allow quoted string separated by pipe, comma, or space
col(B)=pattern("NY|MA", 2, 3);
col(B)=pattern("NY,MA", 2, 3);
col(B)=pattern("NY MA", 2, 3);To generate pattern data based on a column:
col(B)=pattern(col(c), 2, 3); //data source, value repeat count, sequence repeat count
col(B)=uniform(30, col(A)); //randomly choose 30 elements from col(A) to fill col(B)Layer (command) Supports Subrange (ORG-2940)
range rr = wcol(2)[ 1:10 ]; win -t plot; layer -i rr; // Plot rows 1 to 10New System Variables
| Function Area | Variable | Type | Default | Supported | Description |
|---|---|---|---|---|---|---|
ORG-7923 | Smart Labeling | @SLD | bool | 0 |
| globally enable smart labeling of data label |
| @SLDF | double |
| [0.0, 1.0] | favor count factor, missing value means auto | |
| @SLDL | bool | 0 |
| look ahead | |
| @SLDM | double |
|
| measure constant variant, missing value means auto | |
| @SLDR | double |
|
| ray number, -1 means auto | |
| @SLDG | double |
|
| Smart Labeling reposition gap | |
ORG-8396 | Hidden Row | @GMH | bool | 0 |
|
|
ORG-5733 |
| @b3d0 | bool | 1 |
| whether minus values needs down drawing |
| @b3d0b | bool | 1 |
| whether z=0 face shows black color | |
ORG-170 | Polar Grid | @DPA |
| 3 |
| % of DPI as a minimum distance between closest grids |
ORG-7993 |
| @CWS | int | 13 |
| Change Worksheet search option bits. |
ORG-9003 |
| @OGLSL | bool | 1 |
| 1 = Enable shearing for axis titles and tick labels if they are in axis plane and 3D cube has been sheared. 0 = Disable their shearing. |
ORG-7805 | Text Filter | @TFS | int | 1 | 0,1,2,3 | Text Filter label display 0=Enter, 1=Space (default), 2=Comma, 3=Semicolon |
| @TFL | double | 50 |
| The max length of text filter label | |
ORG-6669 |
| @AUFL | bool |
|
| if it is non-zero, always set Auto as auto update mode; if @AUFL equals to zero, check whether there is an operation in the column, if there is, keep therecalculate mode, otherwise, set Auto as recalculate mode. |
ORG-3262 | Paste Unicode | @PSTU | int | 4 | 0,1,2,3,4 |
|
ORG-3262 | Copy Unicode | @COPU | int | 1 | 0,1 | 0 = Disable to put unicode on clipboard 1 = Enable to put unicode on clipboard |
ORG-5618 |
| @ARD | int | 0 | 0, 1 | 0 = Restrict direct arithmetic's like +2 in Script Window |
ORG-8989 | Rescale When Manual | @NRM |
| 0 | 0,1 | 0 = Enable to scale in or scale out (old behavior) when axis scale is set to manual 1 = Disable to scale in or scale out when both axes scale are set to manual |
New LT Objects/Properties/Methods
Name | JIRA | Description |
|---|---|---|
wks.hierarchical | ORG-8452 | LT property to indicate if worksheet is hierarchical (i.e., report sheets) |
LT command to list number of DataRange (ORG-7522)
Running script "list rng;" takes quite a long time to finish the listing. The following command will output the number of DataRange directly.
doc.rangescount()=; /// all ranges
doc.rangescount(16)=; /// all empty ranges
doc.rangescount(32)=; /// all "AutoFill" ranges
Provide Tooltip for any object with Script, Run After set (ORG-8882)
For button in Graph or Worksheet with script behind it, if you set @GSB=1, when mousing over the button, tooltip will tell you how to view/edit script and how to delete the object.