| MATLAB Central > MATLAB Newsreader > fprintf not correctly aligning numbers and text |
|
|
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 5 Jul, 2012 17:22:07 Message: 1 of 20 |
|
I have printed some data to a text file using: |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 5 Jul, 2012 17:34:07 Message: 2 of 20 |
|
Sorry, d = 23 above. |
|
Subject: fprintf not correctly aligning numbers and text From: KJ Date: 5 Jul, 2012 17:35:31 Message: 3 of 20 |
|
first of all i think you want to check if all your fprintf %6d are used. |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 5 Jul, 2012 17:49:10 Message: 4 of 20 |
|
Yes, that is true. The reason for the difference between the number of headers (10) and the number of columns (11) is that first header. Like I said in condition 2.) either that first header must be blank or it must have the header 'index'. The problem is that my other 10 headers come from a cell structure: arr.textdata. Also, I had to come up with a loop to extract this information. |
|
Subject: fprintf not correctly aligning numbers and text From: KJ Date: 5 Jul, 2012 17:52:18 Message: 5 of 20 |
|
yeah for your header you have one fprintf just print the header. |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 5 Jul, 2012 19:08:35 Message: 6 of 20 |
|
On 7/5/2012 12:22 PM, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: TideMan Date: 5 Jul, 2012 21:46:39 Message: 7 of 20 |
|
On Friday, July 6, 2012 5:22:07 AM UTC+12, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 7 Jul, 2012 20:46:14 Message: 8 of 20 |
|
I'm just not getting the headers to line up with the columns. Also the problem I was facing with the first row of data remains.i.e. the first row of data starts on the same line as the headers (just as I showed above). |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 7 Jul, 2012 21:04:48 Message: 9 of 20 |
|
On 7/7/2012 3:46 PM, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 7 Jul, 2012 23:49:06 Message: 10 of 20 |
|
On 7/7/2012 3:46 PM, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 8 Jul, 2012 01:03:15 Message: 11 of 20 |
|
On 7/7/2012 6:49 PM, dpb wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 9 Jul, 2012 17:17:14 Message: 12 of 20 |
|
Ok, it finally seems to be aligning things correctly. |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 9 Jul, 2012 18:13:58 Message: 13 of 20 |
|
On 7/9/2012 12:17 PM, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 9 Jul, 2012 22:42:27 Message: 14 of 20 |
|
> Of course there's a way to space them out--use the same width for the |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 10 Jul, 2012 00:19:16 Message: 15 of 20 |
|
On 7/9/2012 5:42 PM, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 10 Jul, 2012 18:19:17 Message: 16 of 20 |
|
On 7/9/2012 7:19 PM, dpb wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 13 Jul, 2012 00:39:44 Message: 17 of 20 |
|
Ok, that worked. Thanks for the suggestion regarding the index. It is certainly a lot cleaner. |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 13 Jul, 2012 01:01:57 Message: 18 of 20 |
|
> ' Headr' |
|
Subject: fprintf not correctly aligning numbers and text From: dpb Date: 13 Jul, 2012 04:17:31 Message: 19 of 20 |
|
On 7/12/2012 7:39 PM, Eli wrote: |
|
Subject: fprintf not correctly aligning numbers and text From: Eli Date: 13 Jul, 2012 16:49:13 Message: 20 of 20 |
|
Okay, it worked. That was a much a more efficient way for me to be inserting the spaces. |
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
| Tag Activity for This Thread | ||
|---|---|---|
| Tag | Applied By | Date/Time |
| fprintf | Eli | 5 Jul, 2012 13:24:08 |
| sprintf | Eli | 5 Jul, 2012 13:24:08 |
| f | Eli | 5 Jul, 2012 13:24:08 |
| s | Eli | 5 Jul, 2012 13:24:08 |
| repmat | Eli | 5 Jul, 2012 13:24:08 |
