LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Txt file creation

Hi everyone,

I need your help.
There are many threads on txt creation in that forum but I couldn't find the one that answers to my questions.

I'd like to create a txt containing one Header (FILE EDITOR, Time and Date) and  ten columns of data. Every column should be preceded (on top) by the words COLUMN1 to COLUMN10.
The created file should also contain the time and date of creation.

Please see the attached files.

Best regards
Kabanga
Download All
0 Kudos
Message 1 of 11
(3,271 Views)
You seem to be collecting data in a loop. Thus, you have to write out your header before the loop, otherwise you're going to write out the header each time you loop. Right?

Also, you can use the Write to Spreadsheet File VI to write a 2D array of numbers. This will eliminate the Array to Spreadsheet String function on your block diagram, since that VI already takes care of it.
0 Kudos
Message 2 of 11
(3,260 Views)

You are pretty much there...You just need to add the column headers (concatinate all 10 headers with tabs between, before you write the data string).

Where you have the "File Editor" add a tab constant and a time/date string to that concatenate string...

________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
0 Kudos
Message 3 of 11
(3,256 Views)

Hi guys,
Thanks for your help!
I did the modifications you advised me. It's working well:

Now I'd like the following: If make "SAVE" for the same file three times, I'd like it to be like in the attached txt file (data):
How can I implement it?  I've  tried it with "Set File Position" but it's not working.

Best regards
Kabanga

 

Download All
0 Kudos
Message 4 of 11
(3,234 Views)
I added an "open/Create/Replace File.vi with the action as Open/Create before the first write and it worked for me...you need a close file at the end as well....


Message Edited by TWGomez on 04-24-2008 11:50 AM
________________________________________________________

Use the rating system, otherwise its useless; and please don't forget to tip your waiters!
using LV 2010 SP 1, Windows 7
________________________________________________________
Message 5 of 11
(3,229 Views)

Hi Gomez,
it works perfectly. Thanks a lot !!!

Best regards
Kabanga

0 Kudos
Message 6 of 11
(3,212 Views)

Hi all,

I'm struggling with formating my data.  The actual format in my application is %.6e and all data look like that (this is just an example):  1,003433 ( with a comma)...etc  

Is there any way to format the data so that the above number  is  1.003433  (with a dot )  ?

Thanks for your help
Kabanga 

0 Kudos
Message 7 of 11
(3,183 Views)
You're probably on a non-English version of LabVIEW. From the online help:

Localization Codes Determines if LabVIEW uses a decimal or comma to separate the whole number from the decimal part of the number. These codes control the decimal separator for numeric output. These codes do not cause any input or output to occur. They change the decimal separator for all further inputs and outputs until they find the next %;.
%,; Comma decimal separator.
%.; Period decimal separator.
%; System default separator.

0 Kudos
Message 8 of 11
(3,176 Views)
I got an english version of LV.
I made all changes possible with %. and %, but it's still giving me the same results
What can I change else?

Best regards
Kabanga
0 Kudos
Message 9 of 11
(3,169 Views)
What did you actually use for the format string?
%.;%6e will force periods for decimal points
%,;%6e will force commas
%;%6e will give you the system default

You should check to see what you have set in your options for the "Use localized decimal point" option. Go to Tools -> Options, and then select the "Front Panel" tab.
Message 10 of 11
(3,159 Views)