LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequential Data into arrays & simple variables

Hi,
This may seem like a novice question, which is fine because I am a novice.

I am trying to write sequential data into an array and am having huge difficulty with it (LabVIEW is new to my University and I have been given it and told to get on writing this data aquisition program).

I want to write the integrated signal to the array each time there is a count from the coincidence counter, to an index specified by said counter.

Also is there a simple way of having LabVIEW store numbers for later consideration? (ie/ if i want to store a prior integral for comparisson with the new one) I can't find a simple variable option. (Awkward operations in other programming languages seem simple in LabVIEW and simple things, nigh on impossible...)

Thanks,
Mark

Message Edited by kungfuPhysicist on 08-22-2007 04:49 AM

0 Kudos
Message 1 of 6
(3,643 Views)
You are using the Initialize Array function and each time that is called, it creates a brand new array. You've wired the count to the size input so you get an array of count elements all of the same value. In order to insert an array element at a specific index, you would have to initialize the array before the while loop starts and you would have to use the Replace Array Subset. However, you would have to initialize it to a size equal to what your max count might be. Instead, you could write the integral and count to a 2D array. The attached VI has this modification and also shows how to save values in a shift register. With each iteration, a new row is appended to the bottom of the array by using the Build Array function.
Message 2 of 6
(3,628 Views)
Wow, that is great, thanks. My understanding of how to use arrays is much better now (I was thrown in at the deep end a touch). In your VI the data was inserted into the array only every 2/3 coincidences. Is this intrinsic to LabVIEW (it being too slow) I am only testing the input at rates of ~1Hz so I hope not.

I have changed the original file a bit now, attempting a conditional loop. This is supposed to test whether the signal integrated is just noise or is an interesting event (the coincidence is between two scintillator/PMT units above and below the unit from which the signal comes). What I would like it to do is to continually take input from the Coinc Counter and compare it to the position in the array. What it actually does is take one input (of quite a large value as by the time LabVIEW has finished one iteration of the loop the count is up to 12/13) and then gets stuck, as the comparisson value (used in the shift register) will not reach 12, due to me assuming that the program should be waiting for the next count.

Thanks
Mark
0 Kudos
Message 3 of 6
(3,621 Views)
I'm not sure I quite understand what you are trying to do but let me point out a couple of things. The shift register in inner while loop is unitialized. What that means is that it will retain the last value written to it. Also, because you do an auto-index of the integral result, every integral calculation is being written to the 2D array. If you want only the integral result when the loop termination condition is met, then you should not auto-index the output.
Message 4 of 6
(3,607 Views)
Thanks 🙂

You've been a help. But what I want to do is count up on the coincidences and when there is a new coincidence to write to the array. As when there is no new coincidence the integral will just be of some noise which happened to be above the threshold of the amplified and shaped pulse.

I have attempted to do that with the control being held in the shift register (which is why I didn't initialise it) to write to the array the shift register and the coincidence count must coincide (haha).

Unfortunately, by the time the first element in the array has been written, the coincidence count is up to 14 and the shift register is only on 1 (which should, in my thinking, be the next count of coincidence). The coincidence signal is (in this case) set to 1Hz. It follows that for the loop to initialize, run and write to the array takes 14 seconds. Why does it take so long?

Mark

Message Edited by kungfuPhysicist on 08-23-2007 03:58 AM

0 Kudos
Message 5 of 6
(3,581 Views)
I have worked out a solution, it was fairly simple (I think I was trying to make it harder than it was). Just plugged the coincidence count into the initialise input of the integral function.

Thanks for your help 🙂
0 Kudos
Message 6 of 6
(3,568 Views)