LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to address each element in the array of cluster ?

Hello eveyone,

 

I know about the "Controls[]" property of the cluster, which allow to read and write algorithmically element in the cluster.

But when I want to make the same for the array of such cluster, I get a problem.

 

Target: I have a array of cluster in my project in main VI and have lots of VIs which uses this array via reference as global variable. I want to have an option to change this array of cluster (for ex., change number of elements in cluster) at any time and not to spend lots of time while correcting addressing to this array (VIs wants old array of cluster, but gets not what they want).

 

For example, in Table form vi I try to avoid this partly by using "UI helper".

 

Using "IndexVals" property on whole array + "Controls[]" on cluster is not an option because in my case it will result in fast switching of array's index on front panel of Main VI.

 

Please help. In attachment part of my project.

 

Thanks, Gregory.

 

PS. I don't need a correction of my VIs. Just provide please general solution of the problem.

0 Kudos
Message 1 of 7
(3,239 Views)

Hi,

 

Can't read your VI's. Using LabVIEW 2013 SP1.

 

BR,

Vincent

Message 2 of 7
(3,214 Views)

Sorry. Here is a variant for Labview 9.

0 Kudos
Message 3 of 7
(3,206 Views)

Hi dimitriev,

 

Target: I have a array of cluster in my project in main VI and have lots of VIs which uses this array via reference as global variable.

When accessing that array from a lot of locations simultanously you will get RACE CONDITIONS. Easily and fast…

 

Use a FGV aka AE instead to encapsulate your "data object"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 7
(3,195 Views)

Slight example please.

0 Kudos
Message 5 of 7
(3,183 Views)

Had a look at your code and it is very very difficult to follow. It does not help that you have a load of hidden controls and poorly laid out code, and no comments (please look at the LabView Style Guidelines). In the end I gave up trying to work out what you were trying to actually do. However, I am fairly sure that whatever it is you are trying to achieve, you are trying to do so in the most complicated way imaginable!

 

It might help us to help you if you can give a clear and concise explanation of what you are trying to achieve. Then we might be able to suggest an easier way of doing that than trying to change the number of elements in a cluster on the fly, which you can't do!

 

Stu.

Message 6 of 7
(3,169 Views)

@GerdW wrote:

Hi dimitriev,

 

Target: I have a array of cluster in my project in main VI and have lots of VIs which uses this array via reference as global variable.

When accessing that array from a lot of locations simultanously you will get RACE CONDITIONS. Easily and fast…

 

Use a FGV aka AE instead to encapsulate your "data object"!


Another good option sounds like the Data Value Reference.  Those work really well if you want to keep a reference to pass around to everybody.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 7
(3,134 Views)