LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble learning multi dimension arrays

For the last couple of months, I'v taken over supporting LabView in our test lab and have been trying to learn LabView at the same time.
 
I feel that I understand one dimension arrays and clusters, I'm just having a hard time with nulti dimension arrays. All examples just load random numbers. As a contrived exercise, I am trying to wire a LabView program to execute the following pseudocode:
 
row=0
for voltage = 3 to 7 step 2
  for current = 0.015 to 0.045 step 0.015
    if voltage*current < max_power
      bias(row,0)=voltage
      bias(row,1)=current
      row++
 
If I were to generate a text file, the output might look like this, depending on the load line:
 
3,0.015
3,0.030
3,0.045
5,0.015
5,0.030
7,0.015
 
I wire voltage from the outer loop to the inner loop and then can't figure out an easy way to properly load the elements. I'm not looking for an exact solution, just something that demonstrates the principle.
 
I'm using 5.1 on Sun and PC NT/XP machines, but I could probably get my hands on 8.2 if I had to.
 
This forum has been a big help during my self learning. Thank you.
 
gc
0 Kudos
Message 1 of 4
(2,852 Views)
You can try something like the attached diagram. It's just a starter, not optimized for speed when using large arrays, but shows how it can be done.

Hope this helps,
Daniel

Message 2 of 4
(2,842 Views)
Hi gc,

you still use LV5.1?
So I better put a picture inside:

The case structure isn't needed at the moment, but will help you when you change the max_power-parameter or the number of iterations...
You can also use while loops instead of for loops when the number of iterations is not known before (maybe your max values for current/voltage may change too?).

Message Edited by GerdW on 03-19-2007 03:04 PM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 4
(2,842 Views)
Thanks to both of you, that gets me over the hump. I was close, on one attempt, I used a build arrary and now realize I needed two. Most of my maintenance has been easy stuff but I'd like to actually feel like I know LabView.
0 Kudos
Message 4 of 4
(2,801 Views)