LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wrting data right justified column

Hi

 

In my application I am using producer consumer loop architechture. In the consumer loop i am writn data from a queue to a file. I want to write data in a certain format to analyze in another program.   Now when i write dat to a file it writes left justified in six columns. I want it to write to file like the one i have attached. Can somebody tell me how?

0 Kudos
Message 1 of 9
(3,708 Views)

Ideally, you would just use a tab as delimiter and change the justification in the other program as needed. For example in MS word you can define how the tabs are justified.

 

If you want the data right justified in simple text displays (wordpad, notepad), you just need to ensure that the field width is sufficient for the widest data.

 

Try e.g. a format specifier of "%#15_6f' (and make sure that you use a fixed width font for display!)

 

Message Edited by altenbach on 10-08-2008 09:53 PM
Message 2 of 9
(3,697 Views)

Hi

Thanks for the reply. I am using write to text file vi to write data to a file in asc2 format. i attached my part of my vi for you see how iam doing it. I i figured that if i set the width to 13 of the number to fractional string vi my data file is lright justified with 13 charaters to a column. My problem now how to get rid of the trailing zeros of the numbers. I think this would reduse the size of my file.

0 Kudos
Message 3 of 9
(3,660 Views)

Hi

Sorry i forgot to attached picture of my vi. I also attached data file i wrote using my vi.

Download All
0 Kudos
Message 4 of 9
(3,659 Views)

suni wrote:

I am using write to text file vi to write data to a file in asc2 format.


For your reference, it is "ASCII" (American Standard Code for Information Interchange), not "asc2".


suni wrote:

My problem now how to get rid of the trailing zeros of the numbers.


No, if your file is formatted with fixed width lines like this, the file size is determined by the line lenght. A "zero" character is the same size as a "space" character. 🙂

 

Please attach your code, it is extremely convoluted and inefficient. The code inside your case structure, if properly written(!), should be able to fit the size of a postage stamp.

Message 5 of 9
(3,645 Views)
This is the vi. It is large file. I have four sub vi's and main vi. I can only attached 3 files at time. Please tell me how to improve write to file section. I will attached last sub vi in a another post. Thanks very much
0 Kudos
Message 6 of 9
(3,629 Views)
 
0 Kudos
Message 7 of 9
(3,628 Views)
0 Kudos
Message 8 of 9
(3,627 Views)

altenbach wrote:

 

Please attach your code, it is extremely convoluted and inefficient. The code inside your case structure, if properly written(!), should be able to fit the size of a postage stamp.


Hi Altenbach

 

Is there anyway i can make my code afficient?

 

 

0 Kudos
Message 9 of 9
(3,558 Views)