Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

writing data into text file

0 views
Skip to first unread message

Ali Haider

unread,
Dec 31, 2009, 10:02:02 AM12/31/09
to
Hi:

I wish to write the output data in a text file of my program like that:

sr. a b c
1 100.00 252.000 32.00
11 18.20 20.222 1.00
etc.

the data should be aligned with the decimal irrespective of the digits before the decimal. And there will be no change in the position if the digits before the decimal increased, e.g.
sr. a b c
1 100.00 252.000 32.00
11 18.20 120.222 1.00

Suggest me any convenient way to do this.

Best Regards

ALi

ImageAnalyst

unread,
Dec 31, 2009, 10:42:29 AM12/31/09
to
I'd use fprintf(). Make sure you specify field widths.

Ali Haider

unread,
Dec 31, 2009, 11:52:04 PM12/31/09
to
ImageAnalyst <imagea...@mailinator.com> wrote in message <d7a401a5-16d5-4d34...@l2g2000vbg.googlegroups.com>...

> I'd use fprintf(). Make sure you specify field widths.

I am also using fprintf(). I am writing like that:

fprintf('\t\t\t %5.2f', a)

How to specify field width appropriately.

0 new messages