12-06-2020 10:58 AM
Hello,
I am new to Labview. I am trying to read data from the NI9205 module using NI 9149 chassis. I am reading data using DMA FIFO. When I read data for example at 10kS/s. I get an array of 10k samples every second. I want to combine the data of every second in a single array 1dim array. For example, if I run the code for 10 sec I will get 100k samples at 10kS/S. I want to combine them in 1 dim array. Any ideas on how I can do that.
TIA,
Solved! Go to Solution.
12-06-2020 11:04 AM - edited 12-06-2020 11:05 AM
I assume you are trying to build the array in regular LabVIEW, not on the FPGA. Typically you would use a shift register initialized with an empty array, then use built array (concatenate mode) to append new data.
This can put a burden on the memory manager. Do you know the final size beforehand? Is this case it would be better to initialize at the final size and replace with new data as you go, keeping track of the insert point.
12-06-2020 11:16 AM - edited 12-06-2020 11:17 AM
Here are a few options. All three give the same result. It also depends if you need to display the array as it builds or if it is sufficient to get the final result.
A: Replace array subset
B: Built array in concatenate mode
C: Concatenating tunnel.
12-06-2020 11:47 AM
First thanks for a quick reply. I will try these methods. Yes I am processing data on PC.
If I define the size of array will it overwrite the array once the array is full? For example, if I fix the size at 20k samples once the array is full will it overwrite to get the new elements ?
Actually, I want to pick the pre-threshold data of the last 1 sec. I am setting two thresholds one to detect the rising of the curve and one is the final threshold to shut the channel. For that, I will check every incoming array of n sample data and if any sample met my initial threshold, I will start collecting the arrays in one array and when the final threshold is met I will collect the required 10k samples of the last 1 sec.
12-06-2020 12:00 PM
@kazmi12 wrote:
If I define the size of array will it overwrite the array once the array is full? For example, if I fix the size at 20k samples once the array is full will it overwrite to get the new elements ?
It will overwrite whatever data exists at the wired index. If the index is outside the valid range, the data will be lost.
Of course you could manipulate the index so it start over from the beginning when the end is reached. Simple inreger math. 😉
I don't understand your threshold description. Do you just want to keep one single 10k stretch when the conditions are fulfilled?
12-06-2020 12:17 PM
Yes I have to collect data of last 1 sec as the threshold closes the channel (look into the past sort of thing). For example, if my sample rate is 10kS/s and my threshold is 5V. So when a sample of 5V will come my channel will shut down and I want to pick the last 10ksamples before that 5V sample(threshold)