LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing data to text file or excel spreadsheet

Solved!
Go to solution

Hi There,

 

I have a silly question to ask about writing data to a text or spreadsheet file. I have an example which simulates a swept sine via DAQmx. The output it provides is the Frequency Response Function (magnitude and phase) which is plotted on a graph (see VI attached). I would like to use this data for further analysis by having the data on a text file or spreadsheet. I have tried a few things, but the wire is broken. I am guessing I am using the wrong sink - so I was wondering, can you please advise me on which sink I should be using?

 

Your kind help would be much appreciated,

Many Thanks,

 

Raj

0 Kudos
Message 1 of 6
(5,731 Views)

Can you send back the file in version 8.5

THanks

ben

0 Kudos
Message 2 of 6
(5,722 Views)

I think myself and anyone who reads the forum continously can give the solution quickly for you but am not able to open your VI. This time i find the use of my post Save for Previous version and post!

 

Smiley Wink

-----

The best solution is the one you find it by yourself
0 Kudos
Message 3 of 6
(5,715 Views)

Hi all,

 

Sorry about that. This is the first time I am using the forum and I shall remember that for the future.

 

I tried to save it for LabView 8.5, but it kept giving me an error. So, I can tell you where I got the file from if it helps:

http://zone.ni.com/devzone/cda/epd/p/id/5501

 

I will keep trying, otherwise would it be OK if I posted a picture?

 

Your kind help would be much appreciated,

Many thanks,

 

Raj

 

0 Kudos
Message 4 of 6
(5,674 Views)
Solution
Accepted by USB connection

The wire is broken because you cannot connect that datatype to either of those two functions. The source datatype is a 1D array of clusters, where each cluster contains two arrays. The Write Text File accepts strings, not clusters. The Write to Measurement File accepts dynamic data, and while you can convert arrays to dynamic data, there is no built-in mechanism to convert a 1D array of clusters of two arrays.

 

What you'd need to do is to convert the data into a format that can be accepted by these functions. Since you want to have a "spreadsheet" file then you should use Write to Spreadsheet File which creates a delimited text file. Since the frequency data would be the same for the magnitude plot and the phase plot you can have 3 columns: frequency, magnitude, and phase. You can peel off the elements using Unbundle by Name and then create a 2D array from each cluster element. The real question is whether you want to save the data at each iteration and whether you are just adding onto the file. The attached figure shows writing out an initial header and then just continuously adding to the data.

0 Kudos
Message 5 of 6
(5,653 Views)

Thanks for that. I makes sense.

 

Much appreciated.

0 Kudos
Message 6 of 6
(5,615 Views)