On 1/23/2013 1:34 AM, email@example.com wrote: > On Thursday, November 2, 2006 2:26:12 AM UTC+8, Benoît Valley wrote: >> I need to determine the number of line in a text file. >> >> Is there a more efficient way that using getl in a while loop ? >> >> Thanks, >> Benoît > > nrows = numel(cell2mat(textscan(fid,'%1c%*[^\n]')))
If going to do that, would be faster to use a stream form and fread().
I've not timed it but if going to go text route here's where textread() would have the advantage of a) not require separate fopen() and b) returns an array instead of cell so can skip the cell2mat()