LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array values to individual indicators

Solved!
Go to solution

Hi,

 

I am reading some values from an ini file using a 'for loop'. This gives me an array of values which I use throughout my program. So far, so good.

 

I would like to take each value from the array and display it in individual indicators on the front panel.

 

I have solved this by using the 'array to cluster', then the 'unbundle cluster' and the output of this goes to each indicator. See attached vi example.

 

Although this works, I was wondering if there is a more elegant solution. In my example, I'm only using 4 values, so the 'unbundle cluster' is not very big. If I need to display say, 40 values, then this unbundle takes up three quarters of the height of my screen!

 

Any suggestions?

 

 

Regards.

 

 

0 Kudos
Message 1 of 5
(3,388 Views)

Hi,

 

I suggest this.

 

Regards,

 

Yoannindex

 

0 Kudos
Message 2 of 5
(3,376 Views)
Solution
Accepted by topic author sebster

Hi there

 

to get values of array elements use the "Index Array" function from the Array palette. Drag the upper or lower edge to add additional terminals. if you leave the "index" terminal unwired, the function returns element 0, 1, 2 .. See documentation for details.

 

There's no reason to convert the array to a cluster and then get the clusters elements.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 3 of 5
(3,371 Views)

Thanks for this reply.

 

Using the 'index array' function still gives a long (tall?) structure if there are a lot of elements. But I see your point of not needing the conversion to a cluster, so that's certainly an improvement on mine.

 

The reply from Yoann looks promising, although I can't quite see how it works. Wouldn't it just send all values in turn to the one indicator, and leave the last element displayed there at the end?

 

 

Regards.

0 Kudos
Message 4 of 5
(3,366 Views)

Hi there

 

The suggestion from Yoann goes like this:

 

"Add a case for each indicator and place the indicator inside that case. So you would save a lot of space in the block diagram, because all the code is piled up in a case structure"

 

But you pay with an additional for loop and ~40 additional if/then - decisions where all you want to do is to get some array elements. Plus: avoid overlaying code whenever possible.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 5
(3,355 Views)