With a test script, I found a coefficient of less than 1.5. My code would look like this:
tmco = {'NumHeaderLines', 1 , ... 'NumColumns' , 5 , ... 'ConvString' , '%f' , ... 'InfoLevel' , 0 , ... 'ReadMode' , 'block', ... 'ReplaceChar' , {',.'} } ; A = txt2mat(filename, tmco{:});
Note the other ReplaceChar value and the ReadMode block.
I get the following results for a 5 MB file on my (not too new) machine:
- txt2mat test comma avg. time: 0.63231
- txt2mat test dot avg. Time: 0.45715
- textscan test dot avg. time: 0.4787
Full code of my test script:
%% generate sample files fdot = 'C:\temp\cDot.txt'; fcom = 'C:\temp\cCom.txt'; c = 5; %
source share