LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable individual elements in array

How do I disable individual elements in an array at runtime.
0 Kudos
Message 1 of 3
(5,398 Views)
You can remove elemets from an array, but you can't disable individual elements.

Each element of an array has identical characteristics. If you disable one, you disable them all.

Sorry

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 3
(5,390 Views)
I assume you are referring to the control property "disabled".

If so there is no way to disable a single element of an array. By definition an array is a collection of data, it is not a collection of controls. A fine line but an important one. So you can configure the single control that makes up the array and defines its type. For example, if you have an array of Booleans, you can change the color of the Boolean. However this will change the color of all the Booleans in the array. It is 1 control, with a lot of values.

Part of the reason for this is memory. Imagine an array of 1 million elements. If you could set the properties of each element, then to store that array would be incredibly large. It would be 1 million U8s for example, but then all the properties for each 1 million elements would also need to be saved. Therefore your 1 million element array of bytes could easily represent 100 million bytes in memory.

Let me know if this explanation makes no sense, I usually explain it better, but I think I need more coffee. 🙂

The way around this is clusters. You can change each element in a cluster, so if your array is of a manageable size, change your array control into a cluster of n elements. You can then use the cluster to array function to convert the data to the array of data you need. Unfortunately this method means that before runtime you must know the maximum number of elements you will need. You can always hide the extras, but you can not create more during execution.
Message 3 of 3
(5,388 Views)