11-01-2021 12:34 PM - edited 11-01-2021 12:35 PM
I am trying to get data from an oscilloscope a number of times then average them so that each element in the final array is the average of each of the columns from the large array. My problem is that while all intermediate arrays display expected values the final output does not. I am pretty new to labview and i would appreciate any advice.
Some Notes for context:
The vi used to gather the data from the oscilloscope is tektronics TBS series 2000 fetch waveform, it outputs an array that is a single row with (End-start) points the end value is sometimes multiplied by 3 or 6 (but i dont know why) with 10 points it is a multiplier of 1
Raw is all of the data over all of the points
TBA is the column that i want to average
Value to array is the numeric value i want in the final array.
Solved! Go to Solution.
11-01-2021 01:32 PM
I cannot view your VI (using LV 2016), but I would first check the datatype. If your data is an 8-bit integer, the max value is 255. So if you are averaging by adding the data together, you may want to convert to float first.
11-01-2021 01:53 PM - edited 11-01-2021 01:54 PM
Hi CW,
@CWright5517 wrote:
I am trying to get data from an oscilloscope a number of times then average them so that each element in the final array is the average of each of the columns from the large array. My problem is that while all intermediate arrays display expected values the final output does not. I am pretty new to labview and i would appreciate any advice.
I changed your VI a little bit:
Maybe you should explain your problem with more details! So you get expected intermediate results, but the final result is wrong?
Which intermediate data do you get? Which final data do you expect? Which do you get instead?
Mind to share your VI with some default data set in all the controls/indicators?
11-01-2021 02:38 PM
If all you want is the average of all scans, why do you think you need to generate all these huge intermediary data structures??
None of your sequences are needed because execution order is fully determined by dataflow (except maybe the wait if the acquisition takes long compare to the wait. Hard to tell).
I would just sum all scans in a simple 1D array and divide by the number of scans later, e.g. as follows. All you need is one loop!:
(Note that your code has quite a few incorrect steps. For example if you initialize the 2D array at the final size, you need to use "replace array subset" to replace row by row. If you use "insert into array" the final array will be twice the size because you are adding new rows, pushing the rows with zeroes up, thrashing memory!)
11-01-2021 03:41 PM
This did the trick, thank you! I originally had something similar to this but when it didn't work my response was to make it more complicated. I appreciate the help!