rutiger
2007-01-14 20:12:09 UTC
Does anybody know of any tricks or optimized functions for pattern
matching in strings? An example of what I am talking about is the
following:
debug> tic; indx = strmatch('sensor x velocity at aperture center
(DUNITS, PCS)', value_name ); toc
Elapsed time is 0.115318 seconds.
In MATLAB, however:
K>> tic; indx = strmatch('sensor x velocity at aperture center (DUNITS,
PCS)', value_name ); toc
Elapsed time is 0.001158 seconds.
So Octave is 100 times slower than MATLAB in this case. I can speed it
up by using this instead:
debug> tic; indx = find( strcmpi('sensor x velocity at aperture center
(DUNITS, PCS)', value_name ) ); toc
Elapsed time is 0.049141 seconds.
K>> tic; indx = find( strcmpi('sensor x velocity at aperture center
(DUNITS, PCS)', value_name ) ); toc
Elapsed time is 0.000227 seconds.
MATLAB is still amazingly faster. I haven't found anything on the
Octave mailing lists yet, so I am at a loss. This problem is causing a
function that executes in 20(sec) in MATLAB to execute in 5(min) in
Octave.
matching in strings? An example of what I am talking about is the
following:
debug> tic; indx = strmatch('sensor x velocity at aperture center
(DUNITS, PCS)', value_name ); toc
Elapsed time is 0.115318 seconds.
In MATLAB, however:
K>> tic; indx = strmatch('sensor x velocity at aperture center (DUNITS,
PCS)', value_name ); toc
Elapsed time is 0.001158 seconds.
So Octave is 100 times slower than MATLAB in this case. I can speed it
up by using this instead:
debug> tic; indx = find( strcmpi('sensor x velocity at aperture center
(DUNITS, PCS)', value_name ) ); toc
Elapsed time is 0.049141 seconds.
K>> tic; indx = find( strcmpi('sensor x velocity at aperture center
(DUNITS, PCS)', value_name ) ); toc
Elapsed time is 0.000227 seconds.
MATLAB is still amazingly faster. I haven't found anything on the
Octave mailing lists yet, so I am at a loss. This problem is causing a
function that executes in 20(sec) in MATLAB to execute in 5(min) in
Octave.