LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting of output text file.

I am writing values of variables to a text file.  I also have column headings.  Some of the column headings are long, perhaps 14 characters.  The field for my variable values is only 8 characters long.  Thus I would like to install a tab or two between my column headings so that they line up w my values.  How may I do that? 

0 Kudos
Message 1 of 3
(2,679 Views)

Wouldn't you want to put the extra tabs in the data since the data is shorter than the header?

 

How are you currently saving the file?  Care to share some code?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,677 Views)

You can specify a length with the format string

 

So, if the longest string is 14 characters, specify %14s as the format string. Your text will be right justified. If you want the text to appear at the left, use a format specifier of %-14s.

 

Don't play around with multiple TABs, it will make the file difficult to read in other apps like Excel.

 

 

format array as string.PNG


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Message 3 of 3
(2,662 Views)