LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build Array and Output Values to Text or Excel File

Of course you can use the Write to Spreadsheet File to write a header. It can be set for string input with a simple right click>Select Type. Either call it twice where the first use is to write the header and the second is to write the data or call it once where you convert the data to strings.

0 Kudos
Message 11 of 17
(1,012 Views)

Thank you for the reply. I couldn't get it to work before because I was writing to the "2D" of the Write to Spreadsheet File VI and didn't have an array but I got it to work now, :D.

 

I do have one more question about this. Which is better: Write to Spreadsheet File or Write to Text File? I'm not planning on taking over 600 measurements BUT this program could be used to take a lot of measurements in the future, possibly 1000's, so I want the ability to do that.

0 Kudos
Message 12 of 17
(1,006 Views)

Write to Spreadsheet File calls Write to Text File and does the formatting. If you don't call Write to Spreadsheet in a loop, there is really no difference. Write to Spreadsheet opens the file and then closes it so there is a bit more overhead when this is called repeatedly. With Write to Text File, you can control when to open and close the file.

Message 13 of 17
(998 Views)

akhurash wrote: 

I do have one more question about this. Which is better: Write to Spreadsheet File or Write to Text File? I'm not planning on taking over 600 measurements BUT this program could be used to take a lot of measurements in the future, possibly 1000's, so I want the ability to do that.


General hint:  When you see one of the white VIs on a palette that means it's not a primitive (those are that dull yellow color).  You can open it up and look inside to see what it's doing and how it's doing it. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 14 of 17
(995 Views)

Thanks. I still can't figure out why when I use the  Write to Text File the output is all wierd but the Spreadsheet should work.

0 Kudos
Message 15 of 17
(992 Views)

@akhurash wrote:

Thanks. I still can't figure out why when I use the  Write to Text File the output is all wierd but the Spreadsheet should work.


The term "weird" can mean anything, it has no useful definition here. Please specify what you expect to get and what you get instead. Maybe even attach your VI.

0 Kudos
Message 16 of 17
(981 Views)

altenbach, I expected the function to write some measurements (floating numbers) but when I write a lot of measurements (over a 1000) the output weren't floating numbers at all. They were Chinse (Asian) symbols. When I run the file yesterday it was working, the function was writing floating numbers even when I was writing a high number of measurements. I'm not sure why but I guess closing LabVIEW and restarting made it work.

 

I do have one question. Is there away I can clear the contents of a text file before writing to it? I don't want to append or start writing from position 0, I just want to clear all the contents and then write to it agian.

0 Kudos
Message 17 of 17
(949 Views)