LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I access indicators through an array?

I'm taking readings from an oxygen analyzer whose input is connected to a gas
multiplexer that I'm controlling through LabView. On the front panel, I want
to display the latest reading from each source:

Cage 1: xx.xx % O2
Cage 2: xx.xx % 02
Cage 3: xx.xx % O2

Is it possible to put the indicators' value property in an array so that I can
access them through the For loop counter? A pseudocode equivalent would be:

for (i=0; i Switch multiplexer to cage i;
Wait one minute;
sampleValue = Take a single sample;
indicator[i].value = sampleValue; //***This is the line I can't figure out
in LabVIEW.
}

The best I could come up with is to make a case statement with all the
properties that is control
led by the For loop counter, but it's a bit
unwieldy. It seems like there should be a more elegant solution.

-Steve
0 Kudos
Message 1 of 6
(2,991 Views)
The solution lies in the LabVIEW function "replace array element".
You can index with the loopcounter and have the array in a shiftregister.
A shiftregister can be viewed as a local variable within a loop without the copying problems that LabVIEW has with normal local variables.
greetings from the Netherlands
Message 2 of 6
(2,991 Views)
Hi, Albert:

> The solution lies in the LabVIEW function "replace array element".
> You can index with the loopcounter and have the array in a
> shiftregister.

Thanks, but how do I get the indicators' "Value" properties into an array?

-Steve
0 Kudos
Message 3 of 6
(2,991 Views)
Don't put the indicators value in an array but simply use the array indicator in the for loop.
Email your vi and I will take a look at it
greetings from the Netherlands
Message 6 of 6
(2,991 Views)
Hi Steve

On the control panel add an "array control". Put one of the "value
indicators" into the aray control and stretch it to show 3 values aside or
over each other.
In the diagram now you will find an "array of values"-indicator which is
accesible in the For loop.

Best regards
Svend


"Steve Nicholson" wrote in message
news:3B9BA14C.C9430B9C@AMSPAYsteveandmimi.com...
> I'm taking readings from an oxygen analyzer whose input is connected to a
gas
> multiplexer that I'm controlling through LabView. On the front panel, I
want
> to display the latest reading from each source:
>
> Cage 1: xx.xx % O2
> Cage 2: xx.xx % 02
> Cage 3: xx.xx % O2
>
> Is it possible to put the indicators' value property in an array so that I
can
>
access them through the For loop counter? A pseudocode equivalent would
be:
>
> for (i=0; i> Switch multiplexer to cage i;
> Wait one minute;
> sampleValue = Take a single sample;
> indicator[i].value = sampleValue; //***This is the line I can't figure
out
> in LabVIEW.
> }
>
> The best I could come up with is to make a case statement with all the
> properties that is controlled by the For loop counter, but it's a bit
> unwieldy. It seems like there should be a more elegant solution.
>
> -Steve
0 Kudos
Message 4 of 6
(2,991 Views)
> Is it possible to put the indicators' value property in an array so that I can
> access them through the For loop counter? A pseudocode equivalent would be:
>
> for (i=0; i> Switch multiplexer to cage i;
> Wait one minute;
> sampleValue = Take a single sample;
> indicator[i].value = sampleValue; //***This is the line I can't figure out
> in LabVIEW.
> }
>

The other replies pointed in the right direction, but in case you
haven't put it
all together yet, I'll go over the solution that I'd probably implement.

First, make an array showing three values. On the diagram, place
the terminal inside the loop. If you are already using the terminal
in another location and you don't want to move it, you can use a local
or the
value property for the array. The point is that you do not
update a part of an indicator, rather, you modify part of the array
and send it all to the array. The array indicator will not redraw
items that do not change. To get the old value of the array, it
is possible to read from a local, but much better to use a shift
register to cycle the value last written to the local back to the
left side of the loop.

It might seem a bit odd at first, but the terminal and locals are
much better ways to modify the value than the value property.

Greg McKaskle
0 Kudos
Message 5 of 6
(2,991 Views)