LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in waveform mean.

Hi all,

I'm pretty new to LabView programming.

 

I'm trying to read data from a binary file, plotting the waveform and doing some operations with this data (like averaging, std deviation ... ) and saving the results in xls/csv.

I don't have any problem with rebuilding and plotting the three waveforms from the bin file, but the results I got from std deviation & variance block is wrong. I'm matching this result with data on an Excel sheet.

 

The binary file is created by another VI, that's read three voltages from a DAQ and save in a bin and txt file.

More deeply, we have read for 10 seconds three voltages (the supply and the voltage applied to 2 resistors) with a NI9215 DAQ, at the rate of 1kHz and 1000 samples.

We used the data on the txt file to create the Excel sheet.

 

I can't find wich error I'm doing.

 

Many thanks to all.

 

Download All
0 Kudos
Message 1 of 3
(2,726 Views)
  • Please attach your waveform file.
  • Notice the coercion dots on the mean function? It is not designed to operate on arrays of waveforms (and is it not even clear what you expect it to do (create a mean of everything? Creating an array of means, one for each waveform etc.). There is a function that operates on waveforms (amplitude and level measurements). I would change the waveforms to simple arrays immediately for further processing.
  • "Index array" is resizeable and you don't even need to wire the indices here.
  • It seems pointless to have the tab control terminal inside the FOR loop.
  • Instead of the error case, you should use a conditional tunnel.
  • Wouldn't one diagram constant be sufficient in the error case? You can always branch the wire. Avoid duplication!
  • the output of the =0 is not used anywhere.
  • Don't wire under structures
  • There is a plain "mean" function, you don't use the variance.
  • Don't wire right-to-left (output file name constants)
  • Why can't you read the entire file at once?
  • Your various "built array" functions could be replaced by autoindexing (except for the ones where you prepend instead of append. Why would you do that???? Currently, the second and third output will have the values reversed compared to the first file). It is significantly more expensive for the memory manager to prepend. If you want reverse order, append (or autoindex!) and revers the array after the loop.
0 Kudos
Message 2 of 3
(2,716 Views)

Thank you for the fast answer !

I'm applying your advice.


Perhaps I was not clear enough. My fault.
I have done an example about reading one file, but I want to read all files in a folder (I will have 30 bin files), do some operations (like averagin, std deviance, variance ecc.), and create  a csv/xls sheet with all that value.

So I could skip the copy from txt to Excel, and the use of vba macros to delete useless text and blank row.

 

With "the mean of a waveform", I meant that's to create for each file an array with three value:

-the mean of all value of the voltages recorded from the ai0 DAQ's channel;

-the mean of all value of the second voltages recorded from the ai1 DAQ's channel;

-the mean of all value of the thirds voltages recorded from the ai2 DAQ's channel;

So I will save this 3 value in a sheet.

 

Thank you again for the answer.

In the provided files, there are 4 files as an example of what I save from the other VI.

0 Kudos
Message 3 of 3
(2,692 Views)