Thread Subject: textread

Subject: textread

From: Judy

Date: 20 Nov, 2009 23:09:05

Message: 1 of 3

I am using textread to read a file.ext with a bunch of numbers inside. It reads them all except for the last one! Does anyone know why? I also tried textread with a delimiter of \n and it still doesn't work...

Here is a example of the numbers..
116
2845
3555
4783
6748
7051
8420
11078
12540
16038
18066
21597
24390
28349
29880

Textread outputs only:

         116
        2845
        3555
        4783
        6748
        7051
        8420
       11078
       12540
       16038
       18066
       21597
       24390
       28349

Thanks in advance~

Subject: textread

From: MatlabFCT NG

Date: 21 Nov, 2009 00:01:14

Message: 2 of 3

Hi Judy,

I didn't have any problem reading all the numbers...

a=textread('file.ext','%d')

a =

         116
        2845
        3555
        4783
        6748
        7051
        8420
       11078
       12540
       16038
       18066
       21597
       24390
       28349
       29880

Try to use textscan(fid, 'format')... Good Luck!

On Nov 20, 11:09 pm, "Judy " <sauwen...@gmail.com> wrote:
> I am using textread to read a file.ext with a bunch of numbers inside.  It reads them all except for the last one!  Does anyone know why?  I also tried textread with a delimiter of \n and it still doesn't work...
>
> Here is a example of the numbers..
> 116
> 2845
> 3555
> 4783
> 6748
> 7051
> 8420
> 11078
> 12540
> 16038
> 18066
> 21597
> 24390
> 28349
> 29880
>
> Textread outputs only:
>
>          116
>         2845
>         3555
>         4783
>         6748
>         7051
>         8420
>        11078
>        12540
>        16038
>        18066
>        21597
>        24390
>        28349
>
> Thanks in advance~

Subject: textread

From: Judy

Date: 21 Nov, 2009 00:11:04

Message: 3 of 3

Did not try it with '%d' but IT WORKS!!! YOU ARE MAGIC (well the magic of understanding how to use formats) . :)

Thanks!

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

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.

rssFeed for this Thread

Contact us at files@mathworks.com