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: 

Surprising LV global variable of type 2

I'm using a type 2 global variable because I need a big data array shared by
two parallel VI.
The big data array is contained by an indicator in the front panel because
this big data is an output of the load method.
This big data array is an input of other methods so as in the LV example, a
local variable of the big data array is used as input and I have not wired
the big data array indicator as ouput for these methods in order to avoid to
duplicate my big data array.
The result is surprising because:
After the load method, the outputs are right.
The inputs of an other method is correct (local variable) but the data array
changed although I don't changed it .
So the inputs of the second other method are wrong.

So, I
suppose I have to rewrite my big array at every method call, what lose
a lot of time and memory.

Have you a better idea, please?
0 Kudos
Message 1 of 2
(2,856 Views)
> I'm using a type 2 global variable because I need a big data array shared by
> two parallel VI.
> The big data array is contained by an indicator in the front panel because
> this big data is an output of the load method.
> This big data array is an input of other methods so as in the LV example, a
> local variable of the big data array is used as input and I have not wired
> the big data array indicator as ouput for these methods in order to avoid to
> duplicate my big data array.
> The result is surprising because:
> After the load method, the outputs are right.
> The inputs of an other method is correct (local variable) but the data array
> changed although I don't changed it .
> So the inputs of the second other method are wrong.
>
> So, I suppose I have to rewri
te my big array at every method call, what lose
> a lot of time and memory.

Its not exactly clear why you are doing this. A global can't be written
to by
a local, and neither of your options have mentioned a wire going from function
one to function two. I'd suggest that you may not need to use a global
at all,
just a wire.

If you are using a LV2 style global, then you make a call to a subVI
that returns
the needed data on a wire and passes it to the rest of the diagram. This method
doesn't save anything if you are always accessing the entire array.

Greg McKaskle
0 Kudos
Message 2 of 2
(2,856 Views)