Concat(array1,array2,[array3,...]):
Concat() will combine the arrays listed together and return the resulting array. This function can take up to twenty different arrays. This function is useful for things such as Max(Concat(chanX,chanY)) which will return the maximum value of both chanX and chanY. Time is also combined in the concat, so GetTime(Max(Concat(chanX,chanY))) will return the time of the maximum point. The concatenation is a straight concatenation, i.e. Concat({1,2},{3,4,5}) results in {1,2,3,4,5}. Time is concatenated the same way. This is not a problem when doing something like the GetTime(..) expression we used previously, but many parts of DAQFactory, graphs especially, expect an array to be sorted in time. In this case, you will need to use the SortTime() function to put the points in the proper time order. Note also that the arrays must be conformable. This means that they must have the same 2nd and 3rd dimensions. Concatenation always occurs along the rows (1st) dimension.
Fill(Value, Array Size)
Returns an array of Array Size where all elements contain Value.
Fill(5,10) returns {5,5,5,5,5,5,5,5,5,5}
Filter(Array, Criteria Array)
Returns an array of Array's elements where the corresponding row index of Criteria Array is non zero. This is perhaps best explained with an example. Let's say you have two arrays, one "Temperature" and one "Pressure" and you want to get all the pressure measurements where temperature is > 100. To do this, you would do Filter(Pressure,Temperature > 100). Note that this only makes sense if the temperature and pressure measurements line up. The Align() function can help with this if these two inputs are taken at different data rates. If the Criteria Array is shorter than the Array, then Array is first truncated to the length of Criteria array. Here is another, more simple example:
Filter({1,2,3,4,5},{0,1,1,0,0}) returns {2,3}
Flatten(Array)
Takes an array of multiple dimensions and converts it into an array with just one dimension. For example:
Flatten({{1,2,3},{4,5,6}}) returns {1,2,3,4,5,6}
This is especially useful when using the From. functions, which take numbers and convert them into arrays of bytes. The From. functions return an array in the second dimension (i.e. from.uWord(5) = {{5,0}} not {5,0}). This is to allow you to convert an array of values (i.e. from.uWord({5, 10}) = {{5,0},{10,0}}) But chra() does not work on 2 dimensional arrays, so you would use flatten to convert it first, then chra() to convert it to a string to send out a serial or Ethernet port.
InvertArray(Array)
Returns array inverted along the rows dimension. So, InvertArray({1,2,3}) returns {3,2,1} and InvertArray({{1,2}, {3,4}, {5,6}}) returns {{5,6},{3,4},{1,2}}.
IsEmpty(Array)
Returns 1 if the given array is empty (no values). This can be used to determine if a particular channel has a valid value, whether a variable has been initialized, or to look at the return value for functions. Note that "{}" does not generate an empty array. Use NULL instead.
IsNumber(array)
Returns 1 if the given array contains numeric values, 0 if it is empty, or contains strings or objects.
IsObject(array)
Returns 1 if the given array contains object references, 0 if it is empty, or contains numbers or strings.
IsString(array)
Returns 1 if the given array contains string values, 0 if it is empty, or contains numbers or objects.
NumCols(Array)
Returns the number of elements in the Column (2nd dimension) direction of the given array
NumCols({1,2,3}) returns 1.
NumCols({{1,2,3},{2,3,4}}) returns 3.
NumCols({{{1,2,3},{2,3,4}},{{4,5,6},{4,5,6}}}) returns 2.
NumDepth(Array)
Returns the number of elements in the Depth (3rd dimension) direction of the given array.
NumDepth({1,2,3}) returns 1.
NumDepth({{1,2,3},{2,3,4}}) returns 1.
NumDepth({{{1,2,3},{2,3,4}},{{4,5,6},{4,5,6}}}) returns 3.
NumRows(Array)
Returns the number of elements in the Row (1st dimension) direction of the given array.
NumRows({1,2,3}) returns 3.
NumRows({{1,2,3},{2,3,4}}) returns 2.
NumRows({{{1,2,3},{2,3,4}},{{4,5,6},{4,5,6}}}) returns 2.
Point():
Point(Value) returns the index of each element in the rows direction in place of the value of the element. For example, Point({4,2,5,3,8}) will return {0,1,2,3,4}
Search(array, [starting row]) / RSearch(array, [starting row]):
Searches the array starting at the specified row, or the first row if not specified, and returns the row of the first non-zero value, or -1 if not found. RSearch() does the exact same thing, but from the end of the array. These sound like a less than useful functions, but if your remember, you can apply boolean math to an array and it will return an array of 0's and 1's. This means you can search for the first row to match a particular boolean expression. So, if you declared: global y = {1,2,5,2,3,7}
Search(y == 2,0) returns 1 (the row of the first 2)
Search(y == 2,2) returns 3 (the row of the second 2, since we started past the first 2)
Note that these functions only works along the rows dimension.
SeqAdd(Start, Increment, Array Size)
Returns an array of Array Size where the first element contains Start and each subsequent element contains the value of the previous element plus Increment.
SeqAdd(0,1,10) returns {0,1,2,3,4,5,6,7,8,9}
SeqMul(Start, Multiplier, Array Size)
Returns an array of Array Size where the first element contains Start and each subsequent element contains the value of the previous element times Multiplier.
SeqMul(1,2,5) returns {1,2,4,8,16}
Transpose(Array, Dimension)
Takes a one dimensional array and changes the direction to the given dimension. This only works on one dimensional arrays. For dimension, use 0 to create an array with multiple rows, 1 for multiple columns, and 2 for multiple depth.
Transpose({1,2,3},1) returns {{1,2,3}}. This took an array with three rows, and returned an array with three columns.
Unflatten(Array, # of Cols)
Takes a one dimensional array and changes it to a two dimensional array with the given # of columns. The number of resultant rows is calculated from the original size and specified number of columns. So:
Unflatten({1,2,3,4,5,6},2) returns {{1,2},{3,4},{5,6}} an array with 2 columns and 3 rows.
Note that # of Cols must be a factor of the original array size, so Unflatten({1,2,3,4,5},2) will fail because the original array size was 5 and 2 does not divide evenly into 5.