LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequentially storing values to variables from arrays

I have 100 sequentially named variable(a0,a1,a2...) and a 1D array storing 100 values. How to put the value of 0th index in a0 and so on using a for loop or something? I don't want to do it manually.

0 Kudos
Message 1 of 7
(1,369 Views)

@Karan1 wrote:

I have 100 sequentially named variable(a0,a1,a2...) and a 1D array storing 100 values. How to put the value of 0th index in a0 and so on using a for loop or something? I don't want to do it manually.


You have to in some way! Either you need to collect a control refnum from each variable indicator and then access the Value property in a loop or put the terminal or local variable into a case structure with 100 cases inside the loop.

 

The automatically resulting question is: What are you really trying to achieve by such a pretty useless interface?

 

This is not intentionally made so hard to pester you but because it makes usually very little sense to clutter an user interface with 100 controls. And if it is just variables in the diagram, why even bother about it? Keep it in the array and access the index that you need when you need it.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 7
(1,364 Views)

Just do like this:

thols_0-1641904557855.png

 

Certified LabVIEW Architect
Message 3 of 7
(1,345 Views)

@thols wrote:

Just do like this:

thols_0-1641904557855.png

 


But don't complain that it is dead slow! 😁

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 7
(1,332 Views)

@rolfk wrote:

@thols wrote:

Just do like this:

thols_0-1641904557855.png

 


But don't complain that it is dead slow! 😁


Still 1000x times faster than doing it manually 😎 

 

Certified LabVIEW Architect
Message 5 of 7
(1,312 Views)

@Karan1 wrote:

I have 100 sequentially named variable(a0,a1,a2...) and a 1D array storing 100 values. How to put the value of 0th index in a0 and so on using a for loop or something? I don't want to do it manually.


Before we all guess what you mean by "variables", it would help if you could show us a small VI that demonstrates the problem.

 

LabVIEW does not really have "variables" in the classic sense. Are you talking about controls? Indicators? Something else?

 

Where does the data come from?

0 Kudos
Message 6 of 7
(1,296 Views)

Thanks, it is working. It is fast for my application.

0 Kudos
Message 7 of 7
(1,266 Views)