LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write a string and an integer and an array all to the same file?

Solved!
Go to solution

Hi,

I'm currently computing several different types of values with LabView.

I have a sting, a few numbers, and several arrays.

So for example I have a string timestamp, several 'integer' values for example signal amplitude, RMS value, frequency and I have several arrays - signal array, FFT values (peak and location).

Basically I'm trying to figure a way to write all the values to one file. I can write them all the individual types to seperate files (so I can write the amplitude, RMS and frequency to one file, some of the arrays to another)
but is there a way of writing a string and an integer and an array all to the same file?

Any pointers would be very appreciated,

Thanks,

Paula

0 Kudos
Message 1 of 5
(1,580 Views)

Your file will probably store all of the data as text correct? So they can certainly all be added to the same file.

You could use sequential calls to 'write to spreadsheet file' with a different data type each time. Put in carriage returns or comma/tab delimiters in the appropriate places to separate the data.

 

Ian

 

0 Kudos
Message 2 of 5
(1,573 Views)

Is there a way to write them all at the same time? Or does this mean I'll have to open and close the file several times? And each time you write to the file it writes it on a new line?

 

I'm probably not explaining this very well but I'm taking measurements every second. and would like to have a 'line' in my file to correspond to each second.

So I would also like to have it in a format for example.....

time [string], rms [int], amplitude [int], signal frequency [int], fft peaks [array]

 

Is this possible?

 

0 Kudos
Message 3 of 5
(1,563 Views)
Solution
Accepted by topic author meepaula

Your file will be all text... format everything into a text array, build as a single array, 'array to spreadsheet string', write to file.

(I'm sure this will have been on the forums before.... a search would have thrown it up)

file write.PNG

0 Kudos
Message 4 of 5
(1,558 Views)

Thanks very much, that's exactly what I've been looking for. I had a problem where I had decimal numbers and they were being rounded up in the file but the Number to Fractional String has solved this for me.

0 Kudos
Message 5 of 5
(1,543 Views)