« Return to Thread: textread: comment out lines starting with #

Re: textread: comment out lines starting with #

by Søren Hauberg :: Rate this Message:

Reply to Author | View in Thread

tor, 15 10 2009 kl. 19:03 +0200, skrev Eric Chassande-Mottin:
> what about that?

Better, but I'll keep complaining :-) Thanks for looking into this. The
file 'test.txt' is the same as in the previous examples.

== Example 1 ==

In Matlab:

        [a, b] = textread ('test.txt', '%d %s', 'commentstyle', 'shell')
       
        a =
       
             1
             3
       
       
        b =
       
            '2'
            ''

In Octave with your function:

        [a, b] = textread ('test.txt', '%d %s', 'commentstyle', 'shell')
        a =
       
        {
          [1,1] =  1
          [2,1] = 2
        }
       
        error: element number 2 undefined in return list
       
== Example 2 ==

In Matlab:

        a = textread ('test.txt', '%d %d %d', 'commentstyle', 'shell')
        ??? Error using ==> dataread
        Number of outputs must match the number of unskipped input
        fields.

In Octave:

        a = textread ('test.txt', '%d %d %d', 'commentstyle', 'shell')
        a =
       
        {
          [1,1] =  1
          [2,1] =  2
          [3,1] =  3
        }


Søren


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Octave-dev mailing list
Octave-dev@...
https://lists.sourceforge.net/lists/listinfo/octave-dev

 « Return to Thread: textread: comment out lines starting with #