From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a 1D array?

I am new to LabVIEW.

How can I create a one-dimensional double-integer in the VI front panel?

I know to use Modern Control, then choose Array. But how to I set the row (or column size)? And also the data type?

Thanks..

0 Kudos
Message 1 of 4
(25,319 Views)

Hi splee,

 

insert a numeric control into the array control. Then resize the array control as needed...

 

Seems pretty basic, so I recommend to read this!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(25,316 Views)

@splee wrote:

I am new to LabVIEW.

How can I create a one-dimensional double-integer in the VI front panel?

I know to use Modern Control, then choose Array. But how to I set the row (or column size)? And also the data type?

Thanks..


Row or Column size?  Your asking about a 1D array of double type.  You don't deal with rows or columns unless you use multi-dimentional arrays.  To set the number of elements for a 1D array, use the Initialize Array function.  The data type is set by the numeric control that you drop into the 1D array on the fp (default is double).  I would recommend reading some of the basic tutorials given above.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 3 of 4
(25,285 Views)

You drop an array container on the front panel, then place a modern numeric scalar inside it.

 

The default datatype of a numeric control is already DBL, but if you want to change it, you would right-click the array element ...representation.. and select the desired datatype.

 

There are two unrelated measures:

  1. The array size (i.e. the number of data elements)
  2. The number of visible elements (i.e. the size of the container).

(1) is important, while (2) is only cosmetic. For 1D arrays, the container can be resized vertically or horizontally (but not both) to show more or less elements. This does not affect the data or array size.

If the container is too large, the extra elements show greyed and the default data value. If the container is too small, some elements will not show. You can use the index control to decide which array element is shown as upper (or leftmost, resp.) element. You can also show a scrollbar to scroll through the entire array.

 

When first created as described above, the array will be empty. You need to enter at least one element (which can be zero). All elements up the the highest entered element will no longer be greyed out and will correspond to the actual data in the array.

 

If you save and re-load the VI, the array will revert to the default value, which is empty by default. If you want to have different values when the VI is opened, you need to right-click the finished array control and make current values default before saving.

 

Note that there are two ways to right-click an array:

  1. If you right-click an element, you will be able to set the representation and other element properties (These are identical for all elements).
  2. If you right-click the array container (frame, index display, etc), you will be able to set array specific features, such as the default value, show/hide the scrollbar or index display, etc..

 

All clear? 😄

Message 4 of 4
(25,265 Views)