[Top][All Lists]

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

Why is sscanf() so slow?

From: stefan
Subject: Why is sscanf() so slow?
Date: Sat, 25 Jan 2003 14:45:39 -0600

Dear Octaver's,

first of all:  Thanks for great software.  I am using it now for about two
years, especialy for displaying and adjusting measured data (comes from
some measurement bus system to computer).  The software which drives these
devices almostly always produce tab- or comma-seperated data.

For this I do:

    while (isstr(line = fgets(fid)))
      if (index(line, "#") == 1)
      if (length(line) <= 2)
      numbers = sscanf(line, "%g %g %g %g %g %g %g %g", 8);
      for i = 1 : length(numbers)
        values(n, i) = numbers(i);
      n = n + 1;

or very likely...

For more than 1000 lines this takes *ages*.  Is there a better way to do
so or is it a slow implementation in octave?  I would like to see this
improved some day.

For now I do 'save -mat-binary %s values' to keep loading times short next
time.  Some cache algo around the above code.

Any help is appreciated,

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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