LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Align name with data in text file

Hallo all,
 
I got sampled values in a text file:
 
Zeit AV0 AV1 AV2 AV3  
0,000000 2,379331 2,401222 2,381471 2,406654
0,000000 2,379167 2,402045 2,384434 2,408465
0,000000 2,380319 2,401716 2,382294 2,407477
 
 
However the names are not aligned with the corresponding data, how could I make them look in better order?
 
Thanks in advance,
 
win2suse
0 Kudos
Message 1 of 4
(2,701 Views)

Unless you are very particular about the channel header not having white spaces, The simplest thing would be to leave trailing white spaces for each channel header name, such that length of each channel name will be the same as the length of each data element in each column Smiley Wink

Message Edited by devchander on 05-30-2007 06:07 AM

0 Kudos
Message 2 of 4
(2,694 Views)
Hi win2suse,

when all the numbers are in range 0...3 you should use format strings of '%9s' for header line and '%9.6f' for numbers. This will give you columns with width of 9 chars...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 4
(2,681 Views)
Keep in mind that most text fonts have variable-width characters. So, for instance, a '0' might not be as wide as an 'l' in pixels. So just having the same number of characters for each row won't guarantee they'll line up perfectly when viewed as a text file. You'll have to view the file using a font that does have fixed-width characters. I believe Monospace is one of these fonts.

Your other options would be to read the file back into LV and build a little reader program that displays the data in a table. Or if your data is tab or comma-delimited, you can easily import it into Excel if you have that.
Jarrod S.
National Instruments
Message 4 of 4
(2,674 Views)