You can find the size of array parameters by using one of the following
methods: If the Java Type is 'double[]' or 'RealValue[]',
use the java .length operator in DynamicJava: N= array.length; In Jython, use the len function as follows: N= len(array)
If the Java Type is ArrayVariable, use the getSize()method
(for a one-dimensional array) or the getDimSize1(int)
method for a multiple dimensional array in both DynamicJava and Jython: Ncolumns= array2D.getDimSize1(2); For more information, refer to the ArrayVariable.html
file in the following directory: <Isight_install_directory>/<operating_system>/Doc/docs/api/com/engineous/sdk/vars A resizable array parameter with mode Output or In/Out can be resized
by the script at run time.
-
If the Java type is 'double[]', use the following DynamicJava
statement:
myArray = new double[newsize]; This statement resets the value of every element of the array to the
default value of 0.0. In Jython, assign a new list to the array variable. For example, a
list constant: myArray = [3.1, 3.2, 3.3]
If the Java type is ArrayVariable, use the following
statement in both DynamicJava and Jython:
myArray.setDimSize(newSize); When an ArrayVariable is resized this way, the value
of existing array elements are preserved, and new elements are set to
the default value of 0.0.
|