LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save string to a file (.txt or .xls)???

how do i save a string output to a file???? txt or xls???
0 Kudos
Message 1 of 16
(19,617 Views)

Hi manzano,

 

using the "write to text file" function???(??? Does it help to put more question marks in here?)

 

It's also a big difference if you want .txt or .xls files. They need very different aproaches - and txt files are much easier to handle...

 

There are also free online courses for LabView beginners in the academics section of NI's website...

Message Edited by GerdW on 06-23-2009 12:38 AM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 16
(19,616 Views)
If you are trying to save to .xls that implies that you have delimited text. In other words columns separated by a character like a tab. Is this the case? If so, then you can use the Write to Spreadsheet File VI. It will create a text file that can be easily imported into Excel if you really need to.
Message Edited by smercurio_fc on 06-22-2009 06:03 PM
Message 3 of 16
(19,608 Views)

sorry for the extra ???. 

 

how do i save the string to a txt file?

 

regards 

0 Kudos
Message 4 of 16
(19,601 Views)

i dont have delimited text. But i think is easier to save the string output data data to a txt. How do i do it? does "write to spreadsheet file" work too?

 

thanks 

0 Kudos
Message 5 of 16
(19,599 Views)

Where is your data coming from?

Is it in an array? Why is it in string format?

 

If it is in an array, you can use 'write to spreadsheet file' and specify whatever delimeter you want.

Then you can save to a file with a .txt extension.

 

Could you please explain what the format of the data is right now, or show some example data.

Cory K
0 Kudos
Message 6 of 16
(19,595 Views)

Hi Manzano,

 

There are some great examples on how to write a string to file within the LabVIEW Example Finder.  Check out "Read-Write Text File.vi" found under fundamentals>>Strings.

 

Also, there are some examples on the community:

http://decibel.ni.com/content/docs/DOC-3844

http://decibel.ni.com/content/docs/DOC-3052

 

Cheers!

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 7 of 16
(19,548 Views)

Hello!

 

I would like to save a bigger number of strings to .txt file. The .vi mentioned above"https://decibel.ni.com/content/docs/DOC-3052" saves only one string, and if I want to save a new one, it overwrites the one before.

How could I save more of them to one txt file?

Or would it be a better idea to save it to excel files? Thats another "mission impossible" 😄

 

Thanks for a help!

0 Kudos
Message 8 of 16
(17,896 Views)

@VampireEmpire wrote:

Hello!

 

I would like to save a bigger number of strings to .txt file. The .vi mentioned above"https://decibel.ni.com/content/docs/DOC-3052" saves only one string, and if I want to save a new one, it overwrites the one before.

How could I save more of them to one txt file?

Or would it be a better idea to save it to excel files? Thats another "mission impossible" 😄

 

Thanks for a help!


Considering that you are having problems writing text files, I wouldn't venture into ActiveX territory to save actual Excel files.

 

 

0 Kudos
Message 9 of 16
(17,886 Views)

If the file is already open, then writing more data will keep adding it to the end.

 

If the file has been closed, then when you reopen it, you will need to move the file position pointer to the end of the file before writing in order to append more strings.  Look under File I/O >> Advanced File Functions for "Set File Position".

 

I don't recommend using Excel or ActiveX functions unless you are really trying to work with Excel spreadsheet files.  So far you have only indicated that you want to work with text files, so stick with text file functions on the File I/O palette.

0 Kudos
Message 10 of 16
(17,876 Views)