help-octave
[Top][All Lists]
Advanced

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

Reading file


From: Delgon
Subject: Reading file
Date: Thu, 22 Dec 2016 07:21:46 -0800 (PST)

Hey,
I have a problem with slow reads.

    fid = fopen(Filename,'r');
    if fid > 0
      L = '';
      while ischar(L),
        L = fgets(fid);
        if ischar(L),
          T = [T; L];
        end
      end
    end

Everything works great but it is very slow. The problem is 'T = [T; L];'.
When I'm reading file with 100k lines (80 characters per line) it takes 145s
for this file to give me T variable. Without 'T = [T; L];' it takes like
1.5s. With MatLab, same function and file it is gonna process it in around
0.25s and give my my T variable at the end.

Do you have any ideas how could I improve this read function? I would like
to get T in the same format as it is if possoble.

Michal



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Reading-file-tp4681129.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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