[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading data from m files

From: John W. Eaton
Subject: Re: Reading data from m files
Date: Tue, 16 Jan 2007 12:43:17 -0500

On 16-Jan-2007, Quentin Spencer wrote:

| Why a .m file? It's just as easy (and faster) to load .mat or ascii 
| files in both Octave and Matlab. The problem here is that the entire 
| file must be processed by the command parser. Matlab's parser has become 
| much faster than Octave's in recent versions, which exaplains the speed 
| difference. If you really must keep your data in a .m file, then I think 
| it would not be difficult to write a parser as you suggest, which I 
| suspect would be much faster.

If it is not difficult to write a parser that would improve this
specific case of then please suggest ways to improve Octave's parser
and interpreter to handle this special case.  It might not be that
difficult to add something like

  constant_matrix : '[' constant_rows ']'
                    { $$ = finish_constant_matrix ($2); }

  constant_rows   : constant_row
                    { $$ = new tree_constant_row_list ($1); }
                  | constant_rows ';' constant_row
                      $1->append ($3);
                      $$ = $1;

  constant_row    : constant
                    { $$ = new tree_constant_row ($1); }
                  | constant_row ',' constant
                      $1->append ($3);
                      $$ = $1;

and then hook the constant_matrix into the existing rule for building
a general matrix, provided that it doesn't introduce any new conflicts
in the parser.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]