Manuals >Reference >Parameter Extraction Language Print version of this Book (PDF file) |
![]() ![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fundamental ConceptsThe interpreter within IC-CAP can execute programs made up of statements that consist of keywords and expressions. Expressions are constructed from functions, identifiers, and operators. You enter these statements in the text editor that appears when you select Program2 or Program as the function name in the Extract/Optimize folder, or when you open the Macros folder (refer to Chapter 11, "Creating and Running Macros," in the IC-CAP User's Guide). The same interpreter is used to evaluate the expressions entered in various tables providing a consistent syntax throughout the system. Strictly speaking, the expressions appearing in tables are not statements. KeywordsKeywords are reserved by the Parameter Extraction Language. A keyword can be one of the reserved words required for a statement, such as PRINT. It can also be a built-in function or a built-in constant. For keyword descriptions, refer to Built-in Functions and Built-In Constants. Keywords are entered in all uppercase or all lowercase, but not upper and lower case. For example, to call the built-in function MAX: MAX(ic) or max(ic) Although the functions in IC-CAP's Function List can be invoked, those functions, such as RMSerror, are not language keywords. To be used in a Program, expression, or Macro, these functions must be spelled exactly as shown in the Function List. IdentifiersIdentifiers are Parameter Extraction Language variable names; they have the following properties:
Numeric PrecisionYou can control numeric precision by setting the variables WORKING_PRECISION and/or PARAMETER_PRECISION or by using the PEL function val$().
Controlling precision through val$() callsThe function val$() has an optional second argument that can be used to control numeric precision. For example, the statement y=val$(x,12) will convert the number x to a string using up to 12 significant digits if required. Use this form of val$() when the current value of WORKING_PRECISION is acceptable for most of the work at hand, but greater control is required for isolated instances. In those instances, the second argument of val$() can be used to override the current working precision. The examples that follow show how the output varies based on whether or not the WORKING_PRECISION variable is defined, and how the WORKING_PRECISION variable, when defined, is overridden by using val$().
For example, consider the following PEL clause: x=0.39999999999 IF x < 0.4 THEN PRINT x;"is less than 0.4" END IF Since x=0.39999999999, the IF clause will be entered but it will print 0.4 is less than 0.4. To verify the actual value, change the x in the print statement to val$(x,15) . The output will then show 0.39999999999 is less than 0.4. PRINT val$(x,15);"is less than 0.4 Example, Scenario 1
Example, Scenario 2
StatementsThis section describes how to write statements that make up Programs and Macros. The information in this section is not required to use expressions in the editor tables within IC-CAP. Rules for Constructing StatementsAs in BASIC, statements are generally contained in a single line of input. On the other hand, a quoted string can be as many lines long as needed and can contain CR-LFs (carriage return-line feeds). Statements can be arbitrarily complex, and can use parentheses and white space to clarify precedence and improve readability. Keywords must be all uppercase or all lowercase characters. Calls to functions in IC-CAP's Function List must be spelled exactly as they are in the Function List. Use an exclamation mark (!) to comment out a line or any part of a line. Available Statements and CommandsThe following statements are taken from HP BASIC. They are sensitive to the use of CR-LF, and must be written as shown. For example, the ELSE keyword should be followed by nothing on the same line, although a comment (starting with ! ) could follow it. In this section, the abbreviation expr denotes an expression. Expressions are described in Expressions. The abbreviation boolean_expr denotes a boolean expression, generally 0 or 1 (1, as well as any non-zero value, is considered TRUE). For more information, refer to Boolean Expressions. IF THEN with a single statement IF boolean_expr THEN statement IF THEN with multiple statements IF boolean_expr THEN statement1 . . . statementN END IF IF boolean_expr THEN statement1 . . . statementN ELSE statement1 . . . statementN END IF WHILE boolean_expr statement1 . . . statementN END WHILE GET_DATASET prompt_string, variable_name GET_DATASET prompt_string, default_string, variable_name
GET_INT prompt_string, variable_name GET_INT prompt_string, default_string, variable_name
GET_REAL prompt_string, variable_name GET_REAL prompt_string, default_string, variable_name
GLOBAL_VAR <variable_name>
GLOBAL_VAR varX y=varX RETURN y ICCAP_FIND_CHILDREN "/","Model",loadedModels
You should use sizeof() instead of size() because if no objects of the requested type are found, a null string ("") is returned instead of an ICCAP_ARRAY[0]. Since size() returns 1 for a null string, you would first test the result to make sure it is not a null string before using the size() command to determine the number of entries. The sizeof() function returns 0 for a variable that is not an ICCAP_ARRAY[].
ICCAP_FUNC (object_name, menu_function_name, dialog_answer1, ...)
The ICCAP_FUNC statement replaced the MENU_FUNC statement in release 5.0. For backward compatibility, macros containing the MENU_FUNC statement will still work, but new macros should be written using the ICCAP_FUNC statement.
LINPUT or GET_STRING statement LINPUT prompt_string, variable_name LINPUT prompt_string, default_string, variable_name GET_STRING prompt_string, variable_name GET_STRING prompt_string, default_string, variable_name
PRINT expr
PRINTER IS <string>
PRINTER IS "/tmp/tmpfile" PRINT "This text is going to tmpfile" PRINTER IS CRT PRINT "This text is going to the status window" RETURN [expr]
Id = IS * exp(vd / NF / vt) RETURN Id RETURN_VALUE expr
TUNER pname, min, initValue, max, linLogScale, cbStyle, cbName
is a string (or variable array, refer to the section "Using Variable arrays") containing the name of the variable or parameter you want automatically adjusted each time the tuner is adjusted.
is a number (or variable array, refer to the section "Using Variable arrays") that specifies the minimum end of the tuner scale.
initValue is a number (or variable array, refer to the section "Using Variable arrays") that specifies the initial position of the slider.
is a number (or variable array, refer to the section "Using Variable arrays") that specifies the maximum end of the tuner scale
is a number (or variable array, refer to the section "Using Variable arrays") that specifies whether the tuner will have a log scale or not.
is a number (1 or 0) that specifies whether or not the callback is called continuously as the slider moves (while the user has the mouse button pressed) or only when the slider motion is complete (when the user releases the mouse button). 1 Specifies continuous callbacks; 0 specifies endpoint callbacks.
is a string that specifies a Macro or Transform in the same manner you would refer to a macro or transform using a ICCAP_FUNC statement. This Function will be called as indicated by cbStyle. For example, you may have a macro named cb in model m1 and you could specify this macro absolutely with "/m1/cb" or relatively by "cb" from any macro within m1.
SLIDER pname, min, initValue, max, OKFlag, retVal
is a string (or variable array, refer to the section "Using Variable arrays") containing the name of the variable or parameter you want automatically adjusted each time the tuner is adjusted.
is a number (or variable array, refer to the section "Using Variable arrays") that specifies the minimum end of the tuner scale.
initValue is a number (or variable array, refer to the section "Using Variable arrays") that specifies the initial position of the slider.
is a number (or variable array, refer to the section "Using Variable arrays") that specifies the maximum end of the tuner scale
is an expression. 0 means return as soon as the slider is adjusted; nonzero means return only when user clicks OK.
If more than one slider is specified, using arrays, retVal returns the index of the modified slider and the new value is automatically updated to the initValue array. If only one slider is specified via means other than variable arrays, retVal returns the new value of the slider.
Using Variable ArraysTo specify multiple parameters or variables for tuning, you can use variable arrays. The arguments pname, min, initValue, and max must all be variable arrays of the same dimension. (A variable array is defined by setting the value of any variable in a variable table to ICCAP_ARRAY[dim] where dim is the dimension of the array.) For example, if names, mins, maxs, and currs were all variable arrays of dimension 4, and names was an array of param names and mins was an array of min values, etc, the statement TUNER names,mins,currs,maxs,0,1,"mycallback" would invoke a TUNER with 4 sliders on it, one for each parameter in the names array.
Clicking OK on the tuner returns control to the Macro; clicking CANCEL on the tuner aborts the macro currently running.
You can set and access n-dimensional variable arrays. If you set the arrays a=ICCAP_ARRAY[2] a[0]=ICCAP_ARRAY[2] you can then access and set a[0][1] in PEL.
UPDATE_EXPLICIT !suppress all auto-execution of the !transform UPDATE_MANUAL !suppress all auto-execution of the !transform except during an optimization UPDATE_AUTO !auto-execute the transform if a data set !input changes UPDATE_OPTIMIZE !auto-execute upon selection of the !Optimize menu function UPDATE_EXTRACT !auto-execute upon selection of the !Extract menu function
UPDATE_MANUAL will auto-execute a transform during an optimization only if it is a dependency on the simulated target of the optimization.
COMPLEX <array_name>.<type>.<matrix_dimensions>[size_expr]
COMPLEX tmp_array[30+5] ! Common data; 35 complex points; !indexed 0 to 34 COMPLEX tmp_array.M[35] ! Measured data COMPLEX tmp_array.S[35] ! Simulated data COMPLEX tmp_array.B[35] ! Both measured and simulated data ! is allocated COMPLEX t_arr.22[30+5] ! Common data; 35 2x2 (i.e. 2-port) !points COMPLEX t_arr.M.22[35] ! Measured data; 35 2x2 points COMPLEX t_arr.S.22[35] ! Simulated data; 35 2x2 points COMPLEX t_arr.B.22[35] ! Both measured and simulated data is ! allocated COMPLEX t_arr.B.1212[35] ! 12x12 matrix COMPLEX t_arr.B.(r*10+c)[35] ! r, c up to 9x9 COMPLEX t_arr.B.(r*100+c)[35] ! r, c up to 99x99
x = (S1+S2) / 2 RETURN x ! or, simply, RETURN (S1+S2) / 2
AssignmentAssignment is an important statement for complicated computations that require temporary variables or perform extractions. An assignment statement consists of a simple identifier on the left, an = sign, and any allowed expression to the right. It is possible to declare temporary arrays (using COMPLEX) and to assign values to individual points within these arrays.
A single equal sign (=) is used to indicate assignment; a double equal sign (==) is used to test for equality. HP BASIC uses = for both.
The valid forms for assignment are as follows: tempvar = <any expression> <Model parameter> = <REAL expression> <DUT parameter> = <REAL expression> <IC-CAP system variable> = <REAL expression> <tmp_array>.<type>.<row_and_column>[index_expr] = <REAL or COMPLEX expression> In the last case, some fields are optional. The following examples show every legitimate case and demonstrate all valid forms of assignment.
Assigns the bjt Model parameter BF to the ratio of 2 points (ic[0] and ib[0]).
Assigns a value to the Model parameter npn2.BF, if the current Model possesses such a parameter. Failing that, it assigns a value to a BF parameter in another Model named npn2.
Assigns a value to the DUT parameter AREA, within the DC DUT of a Model named npn2.
TNOM is generally defined as an IC-CAP system variable. Here it is assigned a value of 25.
Declares x a temporary variable and assigns an integer. Recommended for loop counters. The maximum integer that you can set is 2147483647 (MAXINT). If you attempt to assign an integer in excess of MAXINT, unreported overflow errors will occur and the actual integer assigned will not be the value you attempted to assign. If you wish to use numbers larger than MAXINT, specify using a .0 at the end of the number (see x = 4.0) or use engineering notation.
Declares x a temporary variable and assigns a double precision floating point number. Not recommended for loop counters due to roundoff errors.
Declares x a temporary variable and assigns it to the ratio of the 2 data sets (ic and ib). Refer to Expressions for an explanation of the double slash (//).
Declares x a temporary variable and assigns to it all the 21 (forward transmission) data within a 2-port data set named S.
Declares x a temporary variable and assigns to it all the measured 21 (forward transmission) data within a 2-port data set named S.
Declares x a temporary variable and assigns to it the data within an Output named ic. If ic only has measured data, only measured data is assigned to x. If ic only has simulated data, only simulated data is assigned to x. If ic has both measured and simulated data, both are assigned to x. If x is not the correct size for the requested data, x resizes to accommodate the data on the right side.
If x has never been assigned or was assigned some value other than a temporary dataset, adding .m to left side has no effect. See x=ic, x=ic.s, x=ic.m. If x was previously defined as a temporary dataset, assigns to its measured array the data within an output named ic. If ic contains just simulated data or if the right side is ic.s, x receives just the simulated data in its measured array. If ic contains common or measured data or if the right side is ic.m, x receives that data in its measured array. If x contains preexisting simulated data, that simulated data is not changed. If x is not the correct size for the requested data, an error occurs.
If x has never been assigned or was assigned some value other than a temporary dataset, adding .s to left side has no effect. See x=ic, x=ic.s, x=ic.m. If x was previously defined as a temporary dataset, assigns to its simulated array the data within an output named ic. If ic contains just simulated data or if the right side is ic.s, x receives just the simulated data in its simulated array. If ic contains common or measured data or if the right side is ic.m, x receives that data in its simulated array. If x contains preexisting measured data, that measured data is not changed. If x is not the correct size for the requested data, an error occurs.
The following statements demonstrate assignment to points in temporary arrays. They require prior use of the COMPLEX statement to declare the temporary array appearing to the left of the equal sign (=). An array index i is assumed in each case to be an integer or integer expression. It should have a value between 0 and size-1, where size was established in a COMPLEX statement. tmp_array.M[i] = 2+2 ! Measured data point assigned value of ! 4 tmp_array.S[i] = 2+2 ! Simulated data point assigned value ! of 4 tmp_array.B[i] = 2+2 ! Measured and simulated data points ! are BOTH assigned tmp_array_x[i] = 2+2 ! Common or measured data point ! assigned value of 4 tmparr.M.21[i] = 2+j5 ! Measured '21' data point receives ! complex tmparr.S.21[i] = 7+20 ! Simulated '21' data point receives ! real tmparr.B.21[i] = 2+j5 ! Measured and simulated '21' data ! points are BOTH assigned tmparr_x.21[i] = 2+j5 ! Common or measured '21' data point ! receives complex The following assignment statements are not valid: COMPLEX x.m[size(beta.m)] x.m = beta.m ! left-side expression must be simple ! identifier, or individual point S = S + S
tmp_array[i] = S[i] ! not valid if S[i] is non-scalar (for ! example, 2-port data) Data TypesThis section describes the primitive data types supported in expressions, Programs, and Macros. These types of data represent the simplest possible expressions. Because IC-CAP automatically assigns data types, it is not necessary to declare a data type for a variable. Thus, to declare and initialize a temporary variable in a Program Transform or Macro, assign a value to it. For example, entering tempvarx = S.m.21[3] automatically makes tempvarx a complex entity (S is assumed to be 2-port data). The variable tempvarx is known only to the Transform program being defined and is discarded when the program finishes. IC-CAP recognizes and operates on the following data types: 2.0, 2e-6, and 2.0k. complex Engineering and scientific notation are accepted in any mix. For example: 2+j2, 2+j*2, and 2.05meg-j1.0e6. pure imaginary j*2, j2, j, and j*1meg. matrix The expression S.M[0] is a matrix example if S is 2-port data. Model and DUT Parameters These are scalar real numbers. When IC-CAP encounters such an identifier (BF for example), it searches for a match in the following order until one is found:
Model parameters can be used in, or assigned to, expressions. BF = 100 x = 2 * BF npn1.BF = 100 !BF in another Model npn1/dc.AREA=1 !AREA in another DUT IC-CAP variables Refer to Model Parameters for a description of how IC-CAP resolves the meaning of symbol names. Like Model Parameters, system variables can be used in, or assigned to, expressions. They have one enhanced capability not shared by the parameters—a string can be assigned to them. For example, EXTR_MODEL="opamp"
VAL$(EXTR_MODEL) data set Arrays of matrices of complex numbers. In the most complex case (2-port S-parameter measured and simulated data), data sets hold an array of measured matrices and an array of simulated matrices. (Refer to "Measured, Simulated, and Common Data" in the IC-CAP User's Guide.) IC-CAP entities considered to be data sets are Inputs, Outputs, and Transforms. The syntax for accessing all or part of a data set is described in the following paragraphs. Temporary arrays, such as those declared by the COMPLEX statement, can also be accessed using the syntax in the examples. In the following examples of data set access, S denotes an existing data set of 2-port data; IC denotes an existing DC data set. Both data sets are type B (both)—they contain measured and simulated data.
These examples are valid for reading data in a temporary array in a Program or Macro, and for reading data in an IC-CAP data set. However, choices are more limited when assigning to (writing to) temporary arrays; also, no assignment can be done directly into IC-CAP data sets (outside of the RETURN statement). For details regarding assignment statement, refer to Assignment.
Produces a data set containing only simulated data. M (measured), S (simulated), and B(both) act as keywords and can be specified in either uppercase or lowercase.
Produces a data set containing both measured and simulated data.
Produces a matrix of measured data. It is the third matrix in S.M, the first being S[0]. An expression can be substituted for 2. In the first case, the system selects measured data by default. Since 2 selects the third matrix, 0 would select the first matrix. This is consistent with HP BASIC, in which OPTION BASE 0 is the default when accessing array elements. The last matrix in S.M can be accessed with the built-in function SIZE: S[size(S)-1]. Results are undefined if you attempt to use indices that are negative or are beyond the end of the data set.
Produces a real number that is the first point in IC's measured data. An expression can be substituted for 0. Note: Omitting the .M extension (IC[0]) defaults to measured data only, NOT both measured and simulated data.
Produces a matrix of simulated data that is the third point (the first is S.s[0]). An expression can be substituted for 2.
Produces a measured and simulated data set with complex data. The term .21 specifies that the data at row 2, column 1 is to be extracted from data set S (this would be the data corresponding to the forward transfer coefficient). The term .21 can be expressed either literally or by an expression in parentheses ( ) up to 9999. (Note that S.21 and S.0201 are equivalent.) For data sets with more than 9 rows or columns, use the 4-digit row-column specification, for example, S.9902 (row 99, column 2).
Produces a complex number. M (measured) is assumed by default. The result is the data for row 2, column 1 of S's first measured data matrix. An expression can be substituted for 0.
Produces the same result as above, but for simulated rather than measured data.
IC-CAP also has some limited string manipulation capabilities. The following are examples of the string type (note the 2 alternatives for including quotation marks in a string): "hello world" "IC-CAP says 'hello world' " 'IC-CAP says "hello world" ' The following is an example of a string used in a statement: PRINT "hello world" x = "hello" Built-in FunctionsThe functions described in this section are built into the Parameter Extraction Language. They can be entered in all uppercase or all lowercase, as in HP BASIC. Some are duplicated in the IC-CAP Function List, like log. Some functions were built in for efficiency with scalar data (the Function List has functions designed to operate best on data sets). Other built-in functions are for programming convenience, such as size and system$.
A function applied to a data set, unless otherwise noted, generates a new data set in which the specified function has been applied to every point. However, the functions max, min, and size each return single numbers only.
absAbsolute value of a single real number or magnitude of a complex number. array_copy(x,yout)Returns 0 if the ICCAP_ARRAY x is copied successfully to the ICCAP_ARRAY yout. For example: abc="ICCAP_ARRAY[6]" abc[0]="foo" abc[1]=1.235 abc[2]=2.33 abc[3]="foo" abc[4]=3 abc[5]=-10.23919 ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} fgh="ICCAP_ARRAY[1]" fgh[0]="hello" ! fgh = {"hello"} print array_equal_str(abc, fgh) print array_copy(abc, fgh) ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} ! fgh = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_equal_str(abc, fgh) 0 0 1 fgh="ICCAP_ARRAY[2]" fgh[0]="ICCAP_ARRAY[3]" fgh[0][0]="foo" fgh[0][1]=1.235 fgh[0][2]=2.33 fgh[1]="ICCAP_ARRAY[2]" fgh[1][0]=0 fgh[1][1]= "ICCAP_ARRAY[4]" fgh[1][1][0]="fee" fgh[1][1][1]=-10.23919 fgh[1][1][2]=3 fgh[1][1][3]="foo" array_copy(abc, fgh) abc="ICCAP_ARRAY[2]" abc[0]="ICCAP_ARRAY[3]" abc[0][0]="foo" abc[0][1]=1.235 abc[0][2]=2.33 abc[1]="ICCAP_ARRAY[2]" abc[1][0]=0 abc[1][1]= "ICCAP_ARRAY[4]" abc[1][1][0]="fee" abc[1][1][1]=-10.23919 abc[1][1][2]=3 abc[1][1][3]="foo" array_copy(abc[1], fgh) fgh="ICCAP_ARRAY[2]" fgh[0]=0 fgh[1]= "ICCAP_ARRAY[4]" fgh[1][0]="fee" fgh[1][1]=-10.23919 fgh[1][2]=3 fgh[1][3]="foo" array_copy(abc[0], fgh[1][3]) fgh="ICCAP_ARRAY[2]" fgh[0]=0 fgh[1]= "ICCAP_ARRAY[4]" fgh[1][0]="fee" fgh[1][1]=-10.23919 fgh[1][2]=3 fgh[1][3]="ICCAP_ARRAY[3]" abc[1][3][0]="foo" abc[1][3][1]=1.235 abc[1][3][2]=2.33 array_equal_num(x,y[,prec])Returns 1 if the ICCAP_ARRAY x elements have the same double values as the corresponding elements of ICCAP_ARRAY y. Returns 0 if the ICCAP_ARRAY x and ICCAP_ARRAY y are not equivalent. The 3rd optional argument prec can be used to specify the double precision to compare the input arrays x and y with when determining their equivalency. For example: abc="ICCAP_ARRAY[4]" abc[0]=-4.23321 abc[1]=1.235 abc[2]=21 abc[3]=-10.23919 ! abc = {-4.23321, 1.235, 21, -10.23919} abc2="ICCAP_ARRAY[5]" abc2[0]=-4.23321 abc2[1]=1.235 abc2[2]=21 abc2[3]=-10.23919 abc2[4]=0.3422 ! abc = {-4.23321, 1.235, 21, -10.23919, 0.3422} abc3="ICCAP_ARRAY[4]" abc3[0]=-4.23321 abc3[1]=1.235 abc3[2]=21 abc3[3]=-10.24 ! abc3 = {-4.23321, 1.235, 21, -10.24} print array_equal_num(abc, abc2, 3) print array_equal_num(abc, abc3, 2) print array_equal_num(abc, abc3, 5) print array_equal_num(abc2, abc3, 3) 0 1 0 0 array_equal_str(x,y)Returns 1 if the ICCAP_ARRAY x elements have the same string values as the corresponding elements of ICCAP_ARRAY y. Returns 0 if the ICCAP_ARRAY x and ICCAP_ARRAY y are not equivalent. For example: abc="ICCAP_ARRAY[4]" abc[0]="foo" abc[1]=1.235 abc[2]="foo2" abc[3]=-10.23919 ! abc = {"foo", 1.235, "foo2", -10.23919} abc2="ICCAP_ARRAY[5]" abc2[0]="foo" abc2[1]=1.235 abc2[2]="foo2" abc2[3]=-10.23919 abc2[4]="foo3" ! abc2 = {"foo", 1.235, "foo2", -10.23919, "foo3"} abc3="ICCAP_ARRAY[4]" abc3[0]="foo" abc3[1]=1.235 abc3[2]="foo2" abc3[3]=-10.23919 ! abc3 = {"foo", 1.235, "foo2", -10.23919} print array_equal_str(abc, abc2) print array_equal_str(abc, abc3) print array_equal_str(abc2, abc3) 0 1 0 array_insert_at(x,y [,pos])Returns 0 if successful and ICCAP_ARRAY x will be modified to include the data y inserted into the data array at the optional 3rd argument integer index pos. If the 3rd argument pos is not specified, the data y will be appended to the end of the ICCAP_ARRAY data array x. For example: abc="ICCAP_ARRAY[5]" abc[0]=1 abc[1]=2 abc[2]=3 abc[3]=3 abc[4]=12 print array_insert_at(abc,55,6) ! abc = {1,2,3,3,12} print array_insert_at(abc,43,5) ! abc = {1,2,3,3,12,43} print array_insert_at(abc,23.33,0) ! abc = {23.33,1,2,3,3,12,43} print array_insert_at(abc,-55.34) ! abc = {23.33,1,2,3,3,12,43, -55.34} print array_insert_at(abc,"foo",2) ! abc = {23.33,1,"foo",2,3,3,12, 43,-55.34} -1 0 0 0 0 array_remove_all(x,y[,prec])Returns 0 if the value y is found and removed in the array x. Returns -1 if unsuccessful. The ICCAP_ARRAY x will be updated to no longer contain all elements found in the array with the value y. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the array x. For example: abc="ICCAP_ARRAY[6]" abc[0]="foo" abc[1]=1.235 abc[2]=2.33 abc[3]="foo" abc[4]=3 abc[5]=-10.23919 ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_all(abc, "unknown" ) ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_all(abc, "5") ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_all(abc, "3") ! abc = {"foo", 1.235, 2.33, "foo", -10.23919} print array_remove_all(abc, 2.33) ! abc = {"foo", 1.235, "foo", -10.23919} print array_remove_all(abc, -10.239, 3) ! abc = {"foo", 1.235, "foo"} print array_remove_all(abc, "foo") ! abc = {1.235} -1 -1 0 0 0 0 array_remove_at(x,pos)Returns 0 if successful and the dataset, complex 1x1 array, or ICCAP_ARRAY x with the data removed from the data array at argument integer index pos. For example: abc="ICCAP_ARRAY[4]" abc[0]=1 abc[1]=2 abc[2]="foo" abc[3]=3 ! abc = {1, 2, foo, 3} print array_remove_at(abc, 2) ! abc = {1, 2, 3} print array_remove_at(abc, 1) ! abc = {1, 3} print array_remove_at(abc, 0) ! abc = {3} print array_remove_at(abc, 0) ! abc = "" ! abc is no longer an ICCAP_ARRAY 0 0 0 0 array_remove_first(x,y[,prec])Returns the integer position of the first occurrence of value y that is found in the array x and removed, or returns -1 if unsuccessful. The ICCAP_ARRAY x will be updated to no longer contain the first element found in the array to contain the value y on return. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the array x for removal. For example: abc="ICCAP_ARRAY[6]" abc[0]="foo" abc[1]=1.235 abc[2]=2.33 abc[3]="foo" abc[4]=3 abc[5]=-10.23919 ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_first(abc, "unknown" ) ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_first(abc, "5") ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_first(abc, "3") ! abc = {"foo", 1.235, 2.33, "foo", -10.23919} print array_remove_first(abc, 2.33) ! abc = {"foo", 1.235, "foo", -10.23919} print array_remove_first(abc, -10.239, 3) ! abc = {"foo", 1.235, "foo"} print array_remove_first(abc, "foo") ! abc = {1.235, "foo"} -1 -1 4 2 3 0 array_remove_last(x,y[,prec])Returns the integer position of the last occurrence of value y that is found in the array x and removed, or returns -1 if unsuccessful. The ICCAP_ARRAY x will be updated to no longer contain the last element found in the array to contain the value y on return. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the array x for removal. For example: abc="ICCAP_ARRAY[6]" abc[0]="foo" abc[1]=1.235 abc[2]=2.33 abc[3]="foo" abc[4]=3 abc[5]=-10.23919 ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_last(abc, "unknown" ) ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_last(abc, "5") ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print array_remove_last(abc, "3") ! abc = {"foo", 1.235, 2.33, "foo", -10.23919} print array_remove_last(abc, 2.33) ! abc = {"foo", 1.235, "foo", -10.23919} print array_remove_last(abc, -10.239, 3) ! abc = {"foo", 1.235, "foo"} print array_remove_last(abc, "foo") ! abc = {"foo", 1.235} -1 -1 4 2 3 2 array_reorder (x,idxarr)Given an ICCAP_ARRAY x of values and an ICCAP_ARRAY idxarr of indices, this function reorders the elements of the ICCAP_ARRAY x using the array of indices idxarr. Returns 0 if array was successfully reordered. For example: abc="ICCAP_ARRAY[4]" abc[0]=-4.23321 abc[1]=1.235 abc[2]=21 abc[3]=-10.23919 ! abc = {-4.23321, 1.235, 21, -10.23919} idxabc="ICCAP_ARRAY[4]" idxabc[0]=2 idxabc[1]=3 idxabc[2]=0 idxabc[3]=1 print array_reorder(abc, idxabc) ! abc = {21, -10.23919, -4.23321, 1.235} 0 array_rsort_num (x, prec[, idxArr])Given an ICCAP_ARRAY x and no 3rd optional argument idxArr, this function will sort the ICCAP_ARRAY x in descending order using the given double precision, specified by the 2nd argument prec. The precision will be used to compare the array elements' double values during the sorting operation. If the 3rd optional argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function will return idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example: abc="ICCAP_ARRAY[4]" abc[0]=-4.23321 abc[1]=1.235 abc[2]=21 abc[3]=-10.23919 ! abc = {-4.23321, 1.235, 21, -10.23919} print array_rsort_num(abc, 5) ! abc = {21, 1.2345, -4.23321, -10.23919} abc2="ICCAP_ARRAY[4]" abc2[0]=-4.23321 abc2[1]=1.235 abc2[2]=21 abc2[3]=-10.23919 ! abc2 = {-4.23321, 1.235, 21, -10.23919} idxabc2="" ! idxabc2 = print array_rsort_num(abc2, 5, idxabc2) ! abc2 = {-4.23321, 1.235, 21, -10.23919} ! idxabc2 = {2, 1, 0, 3} 0 0 array_rsort_str (x[, idxArr])Given an ICCAP_ARRAY x and no 2nd optional argument idxArr, this function sorts the ICCAP_ARRAY x in descending order comparing the array elements' string values. If the optional 2nd argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function returns idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example: abc="ICCAP_ARRAY[4]" abc[0]="foo" abc[1]="fee" abc[2]="foo2" abc[3]="faa" ! abc = {"foo", "fee", "foo2", "faa"} print array_rsort_str(abc) ! abc = {"foo2", "foo", "fee", "faa"} abc2="ICCAP_ARRAY[4]" abc2[0]="foo" abc2[1]="fee" abc2[2]="foo2" abc2[3]="faa" ! abc2 = {"foo", "fee", "foo2", "faa"} idxabc2="" ! idxabc2 = print array_rsort_str(abc2, idxabc2) ! abc2 = {"foo", "fee", "foo2", "faa"} ! idxabc2 = {2, 0, 1, 3} 0 0 array_sort_num (x, prec[, idxArr])Given an ICCAP_ARRAY x and no 3rd optional argument idxArr, this function sorts the ICCAP_ARRAY x in ascending order using the given double precision, specified by the 2nd argument prec. The precision will be used to compare the array elements' double values during the sorting operation. If the 3rd optional argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function returns idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example: abc="ICCAP_ARRAY[4]" abc[0]=-4.23321 abc[1]=1.235 abc[2]=21 abc[3]=-10.23919 ! abc = {-4.23321, 1.235, 21, -10.23919} print array_sort_num(abc, 5) ! abc = {-10.23919, -4.23321, 1.2345, 21} abc2="ICCAP_ARRAY[4]" abc2[0]=-4.23321 abc2[1]=1.235 abc2[2]=21 abc2[3]=-10.23919 ! abc2 = {-4.23321, 1.235, 21, -10.23919} idxabc2="" ! idxabc2 = print array_sort_num(abc2, 5, idxabc2) ! abc2 = {-4.23321, 1.235, 21, -10.23919} ! idxabc2 = {3, 0, 1, 2} 0 0 array_sort_str (x[, idxArr])Given an ICCAP_ARRAY x and no 2nd optional argument idxArr, this function sorts the ICCAP_ARRAY x in ascending order comparing the array elements' string values. If the optional 2nd argument idxArr is specified, then the ICCAP_ARRAY x will not be sorted but instead the function returns idxArr as an ICCAP_ARRAY with an array of sorted indices. Returns 0 if successful. For example: abc="ICCAP_ARRAY[4]" abc[0]="foo" abc[1]="fee" abc[2]="foo2" abc[3]="faa" ! abc = {"foo", "fee", "foo2", "faa"} print array_sort_str(abc) ! abc = {"faa", "fee", "foo", "foo2"} abc2="ICCAP_ARRAY[4]" abc2[0]="foo" abc2[1]="fee" abc2[2]="foo2" abc2[3]="faa" ! abc2 = {"foo", "fee", "foo2", "faa"} idxabc2="" ! idxabc2 = print array_sort_str(abc2, idxabc2) ! abc2 = {"foo", "fee", "foo2", "faa"} ! idxabc2 = {3, 1, 0, 2} 0 0 ascii$Converts ascii-coded characters into literal characters as entered into a text box. chr$(x)Converts the integer x to its equivalent ASCII string character. colsof(x)Returns an integer number of columns in a matrix, complex array of matrix data, or a data set x. For example: complex def[4] complex ghi.55[4] print colsof(def) print colsof(ghi) 1 5 complex_equal(x,y [,prec])Returns 1 if the complex_array or dataset x elements have the same complex values as the corresponding elements of complex array or dataset y. Returns 0 if x and y are not equivalent. Use the 3rd optional argument prec to specify double precision when comparing the x and y data arrays. For example: complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 complex jkl[5] jkl[0]=-3.23+j*6 jkl[1]=1.000+j*2 jkl[2]=3+j*5 jkl[3]=2.3+j*1 jkl[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 6.000000E+000 ! 1 (1,1) 1.000000E+000 2.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 x=complex_copy(def) print complex_equal(def, x) print complex_equal(def, jkl) 1 0 complex_insert_at(x,y [,pos])Returns a new complex array or dataset with the data y inserted into a copy of the dataset or complex array x. If pos, the optional 3rd argument integer position is specified, the data y will be inserted at the index in the copy of the dataset or complex array specified by the x that is returned. If the 3rd argument pos is not specified, the data y will be appended to the end of the returned copy of the data set or complex array x. Only 1x1 matrix complex array data or datasets are supported. The complex array or dataset x will not be modified by this function. For example: complex def[2] def[0]=1.000 def[1]=2.3+j*1 !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 2.300000E+000 1.000000E+000 x=complex_insert_at(def, 3+j*5, 1) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 y=complex_insert_at(x, 443.55) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 ! 3 (1,1) 4.435500E+002 0.000000E+000 z=complex_insert_at(y, "-3.23", 0) !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 4.435500E+002 0.000000E+000 complex_remove_all(x,y[,prec])Returns a copy of the dataset or complex array x with all occurrences of real value y removed, or returns just a copy of the dataset or complex array x if value y was not found. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the magnitude real data of the complex array or dataset x. For example: complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 x=complex_remove_all(def, 3+j*5) !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 y=complex_remove_all(x, -3.23, 3) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 2.300000E+000 1.000000E+000 z=complex_remove_all(y, "2.3") !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 complex_remove_at(x,pos)Returns a copy of the dataset or complex array x with the data removed at position x in the dataset or complex array. Only 1x1 matrix complex array data or datasets are supported. The complex array or dataset x will not be modified by this function. For example: complex def[4] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 x=complex_remove_at(def, 0) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 y=complex_remove_at(x, 2) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 z=complex_remove_at(y, 0) !Point Index R:common I:common ! 1 (1,1) 3.000000E+000 5.000000E+000 complex_remove_first(x,y[,prec])Returns a copy of the dataset or complex array x with the first occurrence of real value y removed, or returns just a copy of the dataset or complex array x if value y was not found. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the magnitude real data of the complex array or dataset x. For example: complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 x=complex_remove_first(def, 3+j*5) !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 ! 3 (1,1) 3.000000E+000 5.000000E+000 y=complex_remove_first(x, -3.23, 3) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 2.300000E+000 1.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 z=complex_remove_first(y, "2.3") !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 a=complex_remove_first(z, 3) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 complex_remove_last(x,y[,prec])Returns a copy of the dataset or complex array x with the last occurrence of real value y removed, or returns just a copy of the dataset or complex array x if value y was not found. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the double value y in the magnitude real data of the complex array or dataset x. For example: complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 x=complex_remove_last(def, 3+j*5) !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 y=complex_remove_last(x, -3.23, 3) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 z=complex_remove_last(y, "2.3") !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 a=complex_remove_last(z, 3) !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 complex_reorder (x,idxarr)Given a complex array or dataset x and an ICCAP_ARRAY idxarr of indices, this function creates a copy of the dataset or complex array x and reorder the elements of the copied data array using the array of indices idxarr, and then returns that reordered copy of the data array x. For example: complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 idxdef="ICCAP_ARRAY[5]" idxdef[0]=4 idxdef[1]=3 idxdef[2]=0 idxdef[3]=2 idxdef[4]=1 x=complex_reorder(def, idxdef) !Point Index R:common I:common ! 0 (1,1) 3.000000E+000 5.000000E+000 ! 1 (1,1) 2.300000E+000 1.000000E+000 ! 2 (1,1) -3.230000E+000 0.000000E+000 ! 3 (1,1) 3.000000E+000 5.000000E+000 ! 4 (1,1) 1.000000E+000 0.000000E+000 complex_rsort (x,prec[,idxArr])Given a complex array or dataset x, this function creates a copy of the dataset or complex array x, then sorts the elements in descending order, and then returns the sorted copy. The 2nd argument prec is used to specify the double precision to use when comparing elements during the sorting of the data array elements. The 3rd optional argument idxArr if specified, will be returned as an ICCAP_ARRAY of sorted integer indices. For example: complex def[5] def[0]=1.000 def[1]=-3.23 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) -3.230000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 x=complex_rsort(def,4) !Point Index R:common I:common ! 0 (1,1) 3.000000E+000 5.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 ! 3 (1,1) 1.000000E+000 0.000000E+000 ! 4 (1,1) -3.230000E+000 0.000000E+000 idxdef="" y=complex_rsort(def, 4, idxdef) !Point Index R:common I:common ! 0 (1,1) 3.000000E+000 5.000000E+000 ! 1 (1,1) 3.000000E+000 5.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 ! 3 (1,1) 1.000000E+000 0.000000E+000 ! 4 (1,1) -3.230000E+000 0.000000E+000 ! idxdef = {2,4,3,0,1} complex_sort (x,prec[,idxArr])Given a complex array or dataset x, this function creates a copy of the dataset or complex array x, and sort the elements in ascending order, and then returns that sorted copy of the complex array or dataset x. The 2nd argument prec is used to specify the double precision to use when comparing elements during the sorting of the data array elements. The 3rd optional argument idxArr, if specified, will be returned as an ICCAP_ARRAY of sorted integer indices. For example: complex def[5] def[0]=1.000 def[1]=-3.23 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) 1.000000E+000 0.000000E+000 ! 1 (1,1) -3.230000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 x=complex_sort(def,4) !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 ! 3 (1,1) 3.000000E+000 5.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 idxdef="" y=complex_sort(def, 4, idxdef) !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 2.300000E+000 1.000000E+000 ! 3 (1,1) 3.000000E+000 5.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 ! idxdef = {1, 0, 3, 2, 4} cutstr(x,y[,delimiter])Returns the size of ICCAP_ARRAY y. Divides a string x into substrings, saving the substrings in ICCAP_ARRAY y, using either whitespace substrings (tabs, spaces, newlines) or an explicitly passed 3rd argument as a delimiter. The leading space will be ignored when using the whitespace as a delimiter. x="a b c" print cutstr(x,y) ! y = {"a", "b", "c"} x="a b c" print cutstr(x,y) ! y = {"a", "b", "c"} x="a,b,c" print cutstr(x,y, ",") ! y = {"a", "b", "c"} x="a,,b,c" print cutstr(x,y, ",") ! y = {"a", "", "b", "c"} x="aspambspamc" print cutstr(x,y, "spam") ! y = {"a", "b", "c"} 3 3 3 4 3 datasetEnables you to access the dataset referred to by a string. A second argument may be specified which is a variable to receive any error string normally going to a red error box. expe is raised to the power specified by the argument. fix_path$Guarantees a path appropriate for the current architecture. fix_path$(<path>)Returns a string based on the passed in <path>, which is either a filename or a directory. The returned string will be the same filename or directory converted to the local architecture. On UNIX, this converts Windows directory separators '\' to UNIX directory separators '/'. On the PC, it does the opposite and also takes care of any cygwin path dependencies. Since IC-CAP uses the cygwin shell to execute the PEL system() and system$() commands, certain calls have cygwin dependencies. For example, print system$("echo $HOME") may return something like /cygdrive/d/users/icuser, which does not have the Windows feel. Therefore, you may want to rewrite the PEL as follows: print fix_path$(system$("echo $HOME")) which returns d:\users\icuser using the above example. get_user_region_names(x,y)Returns the size of ICCAP_ARRAY y. Returns a list of names for the user defined regions of a plot (and a plot within a multiplot). x = get_user_region_names("<Object>", y) For a multiplot, specify the plot number in brackets after the object: x = get_user_region_names("<Object>/Multiplot[1]", y) imagExtracts the imaginary part of a data set, matrix, or complex number. imaginaryExtracts the imaginary part of a data set, matrix, or complex number. index_of(x,y,pos[,prec])Returns the integer index of the first element found starting at position pos that has the same value as y in the ICCAP_ARRAY, dataset, or complex array x. If no elements are found in the data array x, then -1 is returned. The 2nd argument y can be a string or a double value. If value y is a double value, then the optional 4th argument prec can be used to set what precision the function will use to search for the element with the same double value y in the ICCAP_ARRAY, dataset, or complex array x. For example: abc="ICCAP_ARRAY[6]" abc[0]="foo" abc[1]=1.235 abc[2]=2.33 abc[3]="foo" abc[4]=3 abc[5]=-10.23919 ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print "ICCAP_ARRAY output:" print index_of(abc, "unknown", 0) print index_of(abc, 3, 0) print index_of(abc, 3, 5) print index_of(abc, -10.24, 0, 3) print index_of(abc, "foo", 0) print index_of(abc, "foo", 1) complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 print "Complex array output:" print index_of(def, "2.3", 4) print index_of(def, "2.3", 0) print index_of(def, 3, 0, 4) print index_of(def, 3, 3, 4) -1 4 -1 5 0 3 -1 3 2 4 last_index_of(x,y[,prec])Returns the integer index of the last element that has the same value as y in the ICCAP_ARRAY, dataset, or complex array x. If no elements are found in the data array x, then -1 is returned. The 2nd argument y can be a string or a double value. If value y is a double value, then the optional 3rd argument prec can be used to set what precision the function will use to search for the element with the same double value y in the ICCAP_ARRAY, dataset, or complex array x. For example: abc="ICCAP_ARRAY[6]" abc[0]="foo" abc[1]=1.235 abc[2]=2.33 abc[3]="foo" abc[4]=3 abc[5]=-10.23919 ! abc = {"foo", 1.235, 2.33, "foo", 3, -10.23919} print "ICCAP_ARRAY output:" print last_index_of(abc, "unknown") print last_index_of(abc, 3) print last_index_of(abc, -10.24, 3) print last_index_of(abc, "foo") complex def[5] def[0]=-3.23 def[1]=1.000 def[2]=3+j*5 def[3]=2.3+j*1 def[4]=3+j*5 !Point Index R:common I:common ! 0 (1,1) -3.230000E+000 0.000000E+000 ! 1 (1,1) 1.000000E+000 0.000000E+000 ! 2 (1,1) 3.000000E+000 5.000000E+000 ! 3 (1,1) 2.300000E+000 1.000000E+000 ! 4 (1,1) 3.000000E+000 5.000000E+000 print "Complex array output:" print last_index_of(def, 35.355, 4) print last_index_of(def, "2.3") print last_index_of(def, 3.0, 4) print last_index_of(def, "3.00") -1 4 5 3 -1 3 4 4 loglog10 or lgtlookup_instr_table_val or lookup_instr_table_val_evalEnables you to access the value of a field in an instrument options table. The first argument is the path to the table. The second argument is the field in the table (see Set Table Field Value for syntax to specify the field name). An optional third argument may be specified which is a variable to receive any error string normally going to a red error box. lookup_instr_table_val returns NUMPTS if NUMPTS is a variable in # of Points. lookup_instr_table_val_eval returns 100 (presuming NUMPTS evaluates to 100). lookup_obj_attributeEnables you to access the state or attributes of a plot. The first argument is the object and the second argument is the keyword. The syntax is: X=lookup_obj_attribute("<Object>","Keyword") For a Multiplot, specify the plot number in brackets after the object: X=lookup_obj_attribute("<Object>[N]", "Keyword") X=lookup_obj_attribute("/my_model/ my_dut/my_setup/my_multiplot/ Multiplot[1],"UserSelectedRegion") This example returns the coordinates of the white box that the user drew on the second plot (index=1) of the Multiplot my_multiplot. The following table lists supported keywords.
lookup_parEnables you to access the value of a parameter referenced by a string. A second argument may be specified which is a variable to receive any error string normally going to a red error box. lookup_table_val or lookup_table_val_evalEnables you to access the value of a field in an input, output, plot, parameter, or optimizer table. The first argument is the path to the table. The second argument is the field in the table (see Set Table Field Value for syntax to specify the field name). An optional third argument may be specified which is a variable to receive any error string normally going to a red error box. lookup_table_val returns NUMPTS if NUMPTS is a variable in # of Points. lookup_table_val_eval returns 100 (presuming NUMPTS evaluates to 100). lookup_varEnables you to access the value of a variable referenced by a string. A second argument may be specified which is a variable to receive any error string normally going to a red error box. lwc$(x)Returns the lower case version of the string x. For example: print lwc$("Hello") mag or magnitudeComputes the magnitude for a complex number, or for each complex number in a matrix, data set, or data set of matrices. maxTakes any number of arguments, as in HP BASIC. The argument list can be a mixture of scalars and data sets, and the function returns the maximum value found in any of them. This always returns a single real number, and only the real parts are considered. If matrices are received, only the 1,1 points are considered. mdata(expr)Returns the measured part of the argument expr. minBehaves like max, but returns the minimum value. ph or phaseComputes the phase angle in radians for a complex number, or for each complex number in a matrix, data set, or data set of matrices. realExtracts the real part of a data set, matrix, or complex number. rowsof(x)Returns an integer number of rows in a matrix, complex array of matrix data, or a data set x. For example: complex def[4] complex ghi.55[4] print rowsof(def) print rowsof(ghi) sdata(expr)Returns the simulated part of the argument expr. sizeReturns the number of points in a data set, which is an integer. sizeof(x)Returns an integer number of elements in a variable ICCAP_ARRAY, or a complex array of data, or a data set. Returns 0 if x doesn't represent a data array or if the data array is empty or both. For example: abc="ICCAP_ARRAY[5]" abc[0]=1 abc[1]=2 abc[2]=3 abc[3]=3 abc[4]=12 complex def[4] def[0]=1.000 def[1]=1+j*1 def[2]=5 def[3]=6 complex ghi.55[3] x=1.354529 print sizeof(abc) print sizeof(def) print sizeof(ghi) print sizeof(x) Square root function. Complex and negative quantities produce correct complex or imaginary results. strlen(x)Returns the number of characters in the string x. For example: print strlen("Hello") strpos(x,y)Returns the index of the first occurrence of substring str2 found in string str1. An optional third argument may be specified which is an integer starting position that should be greater than or equal to 1. The starting position can be used to specify the starting index within the string str1 to start searching for substring str2. For example: print strpos("Hello","ell") print strpos("Hello","He") print strpos("Hello","dog") print strpos("Hello","l",1) print strpos("Hello","l",4) print strpos("Hello","l",5) 2 1 0 3 4 0 strrpos(str1,str2 [,endpos])Returns the index of the last occurrence of substring str2 found in string str1. An optional third argument may be specified which is an integer end position that should be greater than or equal to 1. The end position can be used to specify the last index within the string str1 to search for the last occurrence of substring str2, using the search range of index 1 to endpos. For example: print strrpos("Hello","ell") print strrpos("Hello","He") print strrpos("Hello","dog") print strrpos("Hello","l",1) print strrpos("Hello","l",4) print strrpos("Hello","l",5) 2 1 0 0 4 4 substr$(x,start,stop)Extracts the substring from the start index to the stop index from the string x. The value "1" refers to the first character in the string. If stop is omitted, substr$ returns the string from start to the end of the string. For example: x="Hello" print substr$(x,4) print substr$(x,2,4) lo ell sys_path$Guarantees a path appropriate for passing to the system$() or system() command. sys_path$(<path>)Returns a string based on the passed in <path>, which is either a filename or a directory. The returned string will be the same filename or directory converted to the proper format for the system$() or system() function. Since IC-CAP uses the cygwin shell to process the PEL system$ and system calls, PC style paths may not work properly when passed as arguments to system functions. For example, if the user's response to LINPUT "Enter a filename",path print system$("ls -al " & path)
However, the following rewrite LINPUT "Enter a filename",path print system$("ls -al " & sys_path$(path)) insures that the system$() call actually sees /cygdrive/d/foobar even when the user types d:foobar. systemAccepts a string argument, which is a shell command to invoke. You can employ all valid shell I/O redirection and other shell syntax within the string argument. It returns an integer, which is the exit status of the shell. If the shell command generates output, it is printed in the terminal window from which the IC-CAP program was started; refer to system$. On the PC, if a syntax error appears, turn on screen debug for additional information. systemAccepts a string argument, which is a shell command to invoke. You can employ all valid shell I/O redirection and other shell syntax within the string argument. It returns an integer, which is the exit status of the shell. If the shell command generates output, it is printed in the terminal window from which the IC-CAP program was started; refer to system$. On the PC, if a syntax error appears, turn on screen debug for additional information. system$Similar to system; it captures the command's output, instead of letting it go to the terminal window. Instead of returning an integer, it returns the output that the shell command generated. For example: my_date$ = system$("date") ! get date com$="echo "&my_date$&"|cut -c 5-7" month$ = system$(com$) ! substring 5-7 On the PC, if a syntax error appears, turn on screen debug for additional information. trim$(x,chars)Where x is a string and chars is a string containing characters to be trimmed from x. This function trims the unwanted characters from the beginning and end of the string. The parameter for chars is optional. If chars is omitted, the default is to remove spaces from the beginning and end of the string. For example: x=" stuff here " print trim$(x) y="////stuff here__//__//" print trim$(y) print trim$(y,"/_") stuff here ////stuff here__//__// stiff here upc$(x)Returns the string x with all upper case characters. For example: print upc$("Hello") HELLO valGenerates a number, given a string representation of a simple (not expression) integer, floating point, or complex number. For example: linput "give a number",x$ x = val(x$) val$Generates a string, given a numeric expression. In conjunction with the & operator (string concatenation), it can be useful for formatting. The optional second argument can either be an integer or a string.
x=1.23456789e-12 print val$(x,"%ICFMT") ! 1.235p (Assuming WORKING_PRECISION not set) print val$(x,"%1ICFMT")! 1.235p (clamped to 4) print val$(x,"%8ICFMT") ! 1.2345679p (8 digits total) print val$(x,"abc %ICFMT") ! abc ICFMT (`abc ' on Linux) (uses printf syntax) print val$(x,"%e") ! 1.234568e-012 (printf format ignores WORKING_PRECISION) print val$(x,"%.3e") ! 1.235e-012 (specify 3 digits after decimal) print val$(x,"The number is %+12.4g.") !The number is +1.235e-012. (12 positions for entire number and +) print val$(x) ! 1.23457E-012 (6 digits of precision by default) print val$(x,7) ! 1.234568E-012
Real and complex scalars and data sets are accepted by all functions with the following exceptions: system, system$, and val expect to receive string data, and val$ expects a scalar number.
Built-In ConstantsSeveral constants are recognized. Like statement names and built-in function names, these are reserved words (for example, you should not attempt to name a variable pi). The recognized constants are: PI or pi 2PI or 2pi J or j (square root of -1) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() ![]() |