LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save Power spectrum

Hi

I would like to save a power spectrum ( about 80000 lines of data) as a file that i can later plot. When i write the cluster (coming out of FFT Powerspewctrum.vi)  to an excel  (excel works only upt o 56000 or something like that, so i can´t use it anyways) or .txt file using the a combination of open -write -close  file i get weird number and letters and not the data i´d like to have. Which data format ( iwould like to make graphs in origin) and vi´s should i use to export the spectrum or is it the best to extract the y-value of the spectrum (magnitude) using the unbundle by name .vi  and export it as txt?

 Thanks for any help
0 Kudos
Message 1 of 6
(5,774 Views)
Hello Philipp Kravanja

the Data Format to use depends on the application, where the data is meant to be imported. Since this is not yet known, i would prefer to save the data in a ASCI text file. I wrote this little Program that does the Job.
The Result of Powerspectrum.vi here is an Array of Clusters. Here only Element 0 of the Arrayis used.
The Cluster contains an Array of the Magnitudes, df and f0. Thats why the Frequency corresponding to each Magnitude has to be calculated in the For Loop. The File is then written Line by Line in the Loop.
To have a clue what colum represents Frequency and Magnitude a Header is written to the File bevore the Loop is entered.
The resulting File could be easily imported to f.e. Matlab.

0 Kudos
Message 2 of 6
(5,741 Views)
thanks a lot

i think that´s what i was looking for.
0 Kudos
Message 3 of 6
(5,733 Views)

I believe this is also something i can use for my application, however, when trying to recreate the code in LabVIEW 2011 SP1, the connections between the For Loop and the Close File return an error that the data types are different.The Path wire returns that the source is 1-D array of byte stream file reference with the sink being byte stream file reference. The Error wire returns that the source is 1-D array of cluster of 3 elements with the sink being a cluster of 3 elements.  How would i go about fixing this?

 

I plan on using this to write to the file from an accelerometer connected to a NI-9234 c-series module through a cDAQ-9178 usb chasssis.  So my intention is to use this as a subVI to connect the accelerometer signal from the DAQ Assist of another VI.  I am trying to record the spectral data. Attached is the attempt at recreating your code.

0 Kudos
Message 4 of 6
(4,986 Views)

Have you taken any basic LabVIEW tutorials such as LabVIEW 101? The default behavior of a wire exiting a for loop is to auto-index it. A scalar is turned into a 1D array, 1D array into a 2D array, etc. Simply right click on the exit tunnel and select 'Disable Indexing'.

0 Kudos
Message 5 of 6
(4,983 Views)

I have gone through the tutorials and have been attending some of the free seminars (going to one next week). I just seem to have forgotten some of the information apparently. This is my first time using any sort of block diagram coding other than Simulink so im still getting my head around it. Thank you for the quick response and i got it fixed.

0 Kudos
Message 6 of 6
(4,980 Views)