LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to selectively choose normalization baseline out of data streamline?

Solved!
Go to solution

Hi all,

 

First of all, I'm a novice of LabVIEW, and my question might look subtle to a lot of you. So, I apologize ahead if that is the case.

 

I'm trying to implement a very simple algorithm in which

 

1) a while loop keeps pulling a series of random numbers,

 

2) and when a user clicks a button, it starts collecting the series of numbers from the moment of clicking and takes average of them, and store it as a global variable.

 

3) and when a user clicks the same button (doesn't have to be the same) again, it goes back and keeps pulling the random number, but this time, the output will be divided by the global variable.

 

Basically, I'm trying to normalize a series of data by selectively choosing my baseline in the strealine of the same data. I tried to combine a few structures (of course including a while loop) such as case, condition, event... but not at all working.

 

If you have any idea or advice, I'd really appreciate it.

 

Thanks!

0 Kudos
Message 1 of 5
(2,575 Views)

Sounds like you are headed in the right direction. Do you keep the normalizing value in a shift register? Initialize the shift register with a value of 1 (not zero) so you can divide by the value on the shift register regardless of the button state.

 

For more specific help you will need to post your VI and describe in detail what is "not at all working."

 

Lynn

0 Kudos
Message 2 of 5
(2,554 Views)

Thanks a lot for your input Lynn,

 

I attached 1d version of my code that I just made. Here I'm just generating a random number to mimick a stream of data. But I want to do the same thing with multiple channels. I also attached trial version in which you can see an error in the second case where I want to update my global array. If there is a way to update my global array by appending 1d array, i think I can get this problem solved.

 

Would you be able to come up with a solution?

Download All
0 Kudos
Message 3 of 5
(2,541 Views)
Solution
Accepted by topic author macindochi

Generally it is not a good idea to use global variables to pass around data which changes frequently. A queue is usually a better way to move data between parallel VIs.

 

Your Start Baseline and Stop Baseline buttons are interchangeable. If either is on, case 1 is selected. An enum might be a better choice. It allows you to clearly indicate to the user what is meant by the cases wher both of your buttons are on or off simultaneously. 

 

I added shift registers for the array and for the normalizing factor.

 

Lynn

0 Kudos
Message 4 of 5
(2,528 Views)

Hi Lynn,

 

I got a very good hint from your VI, and got the problem solved. Thanks a lot!

 

-- Bryan

0 Kudos
Message 5 of 5
(2,501 Views)