LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing local variable dynamically

Hi,

I'm testing 8 motor wich run in sequence for a certain amount of time...
Each motor has a specific graph and information that should be updated...
I'm using a for loop (n=8) and I'd like to use a generic local variable (changing its reference according to 'n') to update the right graph each iteration...
Right now I'm using a Case (with 8 possibilities). Should be easier...
Can this be done?

Thanks

Erick
0 Kudos
Message 1 of 4
(3,002 Views)
I'm gonna try to help you. I've made a little VI that could be I think a solution for you if you want to update the graphs.
Hope this helps !
Julien
0 Kudos
Message 2 of 4
(3,002 Views)
Hi,

How about using an array with 8x the data? Also consider a shift register
i.s.o. a local. If the data to be stored in the array is an array itself,
put it in a bundle/cluster first (or all arrays will become the same size).

You have to get the element, change it, and replace the original element in
the array. Also note that the array might be empty at start, and replacing
an empty element doesn't do anything, so the array will remain empty. So the
array has to be initialized.

All this might get messy, and to prevent this, you could write a functional
global (e.g. with functions 'set samples', 'add sample','read samples',
'read sample'). This always wraps things up nicely (although it might not
sound like it, it does). And once you've done this, the functio
nal global
will very easy to "grow", in number of charts, but also in functionality.

Regards,

Wiebe.


"dumbest_dummie" wrote in message
news:506500000008000000CDCA0000-1079395200000@exchange.ni.com...
> Hi,
>
> I'm testing 8 motor wich run in sequence for a certain amount of
> time...
> Each motor has a specific graph and information that should be
> updated...
> I'm using a for loop (n=8) and I'd like to use a generic local
> variable (changing its reference according to 'n') to update the right
> graph each iteration...
> Right now I'm using a Case (with 8 possibilities). Should be easier...
> Can this be done?
>
> Thanks
>
> Erick
0 Kudos
Message 3 of 4
(3,002 Views)
"dumbest_dummie" wrote in message
news:506500000008000000CDCA0000-1079395200000@exchange.ni.com...
> Hi,
>
> I'm testing 8 motor wich run in sequence for a certain amount of
> time...
> Each motor has a specific graph and information that should be
> updated...
> I'm using a for loop (n=8) and I'd like to use a generic local
> variable (changing its reference according to 'n') to update the right
> graph each iteration...
> Right now I'm using a Case (with 8 possibilities). Should be easier...
> Can this be done?
>
> Thanks
>
> Erick
>

Hy Eric,

If I understood you right, you are trying to edit 8 graphs in a loop and
with each loop step you'd like to modify a special one of your collection of
8.

To do this I would get all eight references of
the graphs and put it into
an array ordered just like you'd like update
the graphs.
this array can be passed to the loop with auto indexing
and so you'll get automatically get the right reference of the graoh to be
updated.
Message 4 of 4
(3,002 Views)