LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array help needed!

hi folks
 
im trying to output a series of values from a power calculation over time, and grap the mean power vs time.
so this is the end of my vi, i want to store the values one after another and then export the mean of them to the measurement block., i have a stacked sequence structure, can i leave the array blocks inside the main loop? i would like to gather readings every 500ms is possible.
 
 
where can i inprove on this?
 
regards
 
Eric
 
0 Kudos
Message 1 of 7
(2,531 Views)
I'm not sure I fully understand what your're doing since this is a pretty small snippet of your code and the sequence structure is barely visible. I do spot some potential problems. I don't think you fully grasp how data is passed out of a while loop. If you wire something (a scalar, array, whatever) straight out, what you have outside the while loop is just the very last value. For example, if you were to run a while loop 3 times with an indicator inside the loop and the values of the indicator were 1.5, 1.2, 1.7, if you wire to an indicator outside the loop, all it will show is 1.7. You can right click on the output tunnel of a wire and select Enable Indexing. If you wire a scalar out of a while loop with this, you will create an array outside the loop that has all of the values. Wire a 1D array out with indexing on, and you will get a 2D array outside. The auto-indexing feature is the default with a For loop but it is optional with a While loop. You can also create a shift register and use the Build Array inside to pass an array of values outside the loop.
0 Kudos
Message 2 of 7
(2,511 Views)
ok, i have cleaned up my vi, so you can have a look at it now. i will digest what you said as see if i can get this array going.
i want to retain all the values coming from the power and get the mean of them, as you know.
 
best
 
Eric
0 Kudos
Message 3 of 7
(2,496 Views)

hi there

 

i have made some progress i think, im getting the values changed on the output of the build array, but when i take them out of the loop into a 2d array, the output isnt right.......

what do you think? once i get the array i want to get the mean of this (power) and send it to the measurement for excel plot.

 

 

0 Kudos
Message 4 of 7
(2,494 Views)
Someone else is going to have to look at your VI. I don't have 8.0 yet.Smiley Sad
0 Kudos
Message 5 of 7
(2,483 Views)

Hi all

I have posted a response on this thread I believe it to be part of  the same problem.

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=168407

 

I hope this helps

 

Tim

 

NI UK AE

0 Kudos
Message 6 of 7
(2,427 Views)
Hello 1231,

I made some changes to your vi.
But there are still some errors in it (see comments, RTFM: sequence locals).
Well, you cannot get the correct 2d array, if you put a "Array size" function in the wire... Or do you just want to know the number of samples?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(2,413 Views)