title: Reading and processing a large text file in Matlab
body: <p>I'm trying to read a large text file (a few million lines) into Matlab. Initially I was using importdata(file_name), which seemed like a concise solution. However I need to use Matlab 7 (yeah I know its old) and it seems importdata isn't supported. As such I tried the following:</p>
  
  <pre><code>while ~feof(fid)    
      fline = fgetl(fid);
      fdata{1,lno} =  fline ;
      lno = lno + 1;
  end
  </code></pre>
  
  <p>But this is really slow. I'm guessing its because its resizing the array on each iteration. Is there a better way of doing this. Bearing in mind the first 20 lines of the input data are string type data and the remainder of the data is 3 to 6 columns of hexadecimal values.</p>