Jump to content

Array Size function: Difference between revisions

From LabVIEW Wiki
Created page with "{{stub}} thumb|Array Size function Returns the number of elements in each dimension of an array. {{LabVIEW Palette Object Information|pale..."
 
Update and clarify contents
Line 1: Line 1:
{{stub}}
[[File:Array Size - Terminals.png|thumb|Array Size function]]
[[File:Array Size - Terminals.png|thumb|Array Size function]]


Returns the number of elements in each dimension of an array.
{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/Array{{!}}Array palette|type=function}}
{{LabVIEW Palette Object Information|palette=Functions Palette/Programming/Array{{!}}Array palette|type=function}}
The '''Array Size''' function returns the number of elements in each dimension of an array.


== Usage ==
== Usage ==


Connect the input terminal to an array. The node adapts to the data type and returns either a single element for a one-dimensional array, or a subarray for higher dimensional arrays.
Connect the input terminal to an array of any type. The node automatically adapts to the connected array and returns either a single numeric value for a one-dimensional array, or an array of numeric values for multidimensional arrays.
 
[[File:Array Size - Examples.png]]


== Best practice ==
== Best practice ==


* Use the [[Add Array Elements function]] to calculate the sum of elements in a multi-dimensional array.
* Use the [[Add Array Elements function|Add Array Elements]] function to calculate the sum of all elements in a multidimensional array.
 
* Use the [[Index Array function|Index Array]] function on the return value for multidimensional arrays to get size values for individual dimensions.
== History ==
 
== See also ==
 
== External links ==


[[Category:Array Palette]]
[[Category:Array Palette]]

Revision as of 17:22, 3 September 2019

Array Size function
Object information
Owning palette(s) Array palette
Type Function
Requires Basic Development Environment

The Array Size function returns the number of elements in each dimension of an array.

Usage

Connect the input terminal to an array of any type. The node automatically adapts to the connected array and returns either a single numeric value for a one-dimensional array, or an array of numeric values for multidimensional arrays.

Best practice

  • Use the Add Array Elements function to calculate the sum of all elements in a multidimensional array.
  • Use the Index Array function on the return value for multidimensional arrays to get size values for individual dimensions.