04-12-2012 04:41 AM
Hi there, I have problem with my block diagram. I have project to display data (from temperature sensor NICrNi) from multiple channels and saving the data into csv and Diadem file continuously. Now,the problem is how to mean 2D (double data types) continuous data? because the result of the measurement are very unstable.. I have try using Mean PtByPt VI function but it need double data types input.. So are there are any other way to mean data? for example i need a mean data for every 20 samples..
Solved! Go to Solution.
04-12-2012 05:28 AM
I think you need to use the mean vi from the probability and statistics
04-12-2012 05:56 AM
i have try it but it need double data types input. In my case is I need to mean 2D data of double precision floating point number, so i cannot wire it.
this is the example of my block diagram..
04-12-2012 06:09 AM
If I understand your question, I think you have more than one sensor and you are reading the signals from these sensor, the 2D array outputs from the acquisition vi should represent the data acquired from the sensor. So you need to index the array in order to get 1D arrays each of these arrays represents readings from one sensor, after that use the mean vi from the Probability and statistics pallet. check the attached
Note: the vi you attached does not contains all the subvis, so I cannot open it.
Hope this helps.
04-12-2012 07:52 AM
Your data are stored in a 2-D array, as you have continuous samples of multiple channels. For example, let's say you are recording from 6 channels at 10 Hz. Then every tenth of a second, another six points will be generated (one per channel) and written to your output file.
Let's say you record for 10 seconds, hence take 100 samples. Your data file will have 100 "groups" of 6 samples, one per channel for each time point. If you read this into an array, you'll have a 2-D 100 by 6 array. If you "feed" this array into a LabVIEW For loop, it will "pick out" each of the 100 time samples, presenting you with a 1-D array representing the 6 channels that you took at some time. While you could average over the six channels, what you really want to do is to average over the 100 time points for each of the 6 channels.
For the PtByPt methods to work, you need to feed each channel, one sample at a time, into its own averager. If you know, in advance, the number of channels in your sample, you can simply create one averager per channel on your Block Diagram. [This is a little clumsy, but will certainly work -- there are probably "elegant" ways to do this at Run Time for an arbitrary number of channels, but that's Another Topic]. Here's a VI that would work for a known data set having 6 channels.
I hope this answers your question.
04-12-2012 08:10 AM
I interesting in your answer Bob,
I'm sorry for asking a ridiculous question (because I'm newbie in LabView ), But what is the name of the component after array to cluster one??
04-12-2012 08:30 AM
That's the "Mean PtByPt" VI, sometimes called a "running average". What you do is "feed" it a string of numbers, and it outputs a string of numbers, averaging over the last N (100 by default) of them. Thus the first number out will be the average of the previous 1 number, the second the previous 2, the third the previous 3, the 100th the previous 100, the 1000th the previous 100, the 10,000 the previous 100 (do you see the pattern?).
04-12-2012 08:34 AM
It is called unbundle cluster array on the cluster palet. It is only two tall on that palet so it can be resized for the cluser size.
04-12-2012 08:41 AM
04-12-2012 08:47 AM
I have try it Bob,
But I have problem with the data. as you can see the display become like this:
Before:
AinChan0 | AinChan1 | AinChan2 | AinChan3 | AinChan4 | AinChan5 | Time | |
0,274658 | 27,770996 | 0,396729 | 0,091553 | 0,12207 | 0,244141 | 12:04:2012 15:41:23,532 | |
0,366211 | 26,580811 | 0,396729 | 0,183105 | 0,274658 | 0,427246 | 12:04:2012 15:41:23,554 | |
0,183105 | 26,489258 | 0,213623 | 0,183105 | 0,152588 | 0,213623 | 12:04:2012 15:41:23,564 | |
-0,488281 | 21,66748 | -0,396729 | -0,091553 | -0,061035 | 0,061035 | 12:04:2012 15:41:23,574 | |
0,213623 | 26,763916 | 0,366211 | 0,213623 | 0,183105 | 0,335693 | 12:04:2012 15:41:23,584 |
After:
AinChan0 | AinChan1 | AinChan2 | AinChan3 | AinChan4 | AinChan5 | Time | |
0,061035 | 13,076782 | 8,748372 | 6,584167 | 5,273437 | 4,40979 | 12:04:2012 15:35:38,642 | |
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
3,662109 | 5,893707 | 5,174425 | 4,611206 | 4,164262 | 3,789266 | 12:04:2012 15:35:38,664 | |
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 | ||
0 | 0 | 0 | 0 | 0 | 0 |
|
Note : I only use channel 1 for the testing