help-octave
[Top][All Lists]
Advanced

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

Re: Saving calculation answers to file


From: vilsu
Subject: Re: Saving calculation answers to file
Date: Tue, 24 Jul 2012 12:28:39 -0700 (PDT)

Little testin:
sample run 3040 lines, P4 2400MHz

Run1:

fid = fopen ("koe.txt");
        for i = 1:3040
           x = eval (fgetl (fid))
           save -append tuloskoe.txt x
        endfor;
fclose (fid)

-:took 15 s:-


Run2:

fid = fopen ("koe.txt");
eof = fgetl (fid)
while eof != -1
      x = eval (eof);
      save -append out.txt x
      eof = fgetl (fid)
endwhile;
fclose (fid)

-:took 9 s:-


Run3:

fid = fopen ("koe.txt");
results = cell(3040,1);
for i =1:3040
      results{i} = eval (fgetl (fid));
endfor
save out.txt results
fclose (fid)

-:took 3 s:-  !!! only 1/5 of the time of the original!!

Thanks Juan

vilsu





--
View this message in context: 
http://octave.1599824.n4.nabble.com/Saving-calculation-answers-to-file-tp4631628p4631655.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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