title: How can I import my large text file in MATLAB
body: <p>My file has a header and the a header of each col and then the cols. I'm interested in pulling out the data from just the 4th col into a MATLAB variable.</p>
  
  <p>Ive run into a few problems. One is that there are about 3 million cells and MATLAB truncates this for some reason when I use the import wizard (it truncates the file to 191,686 rows).</p>
  
  <p>Here is the first few lines of the file: </p>
  
  <pre><code>Channels:   1  
  Count:  3600000  
  Start:  40640.854055    04/07/11 16:29:50  
  End:    40640.895721    04/07/11   17:29:50                                                                            
  
  Date    Time    Time Stamp  Time from Start EEG 1_8401  
  04/07/11           16:29:50        40640.687388    0.000000        3.854626e+001     
  04/07/11           16:29:50        40640.687388    0.001000        2.664706e+001     
  04/07/11           16:29:50        40640.687388    0.002000        1.425481e+001     
  04/07/11           16:29:50        40640.687388    0.003000        1.704369e+000     
  04/07/11           16:29:50        40640.687388    0.004000        -1.070827e+001   
  04/07/11           16:29:50        40640.687388    0.005000        -2.290569e+001   
  </code></pre>
  
  <p>Here is the script that I used to import the file when it was truncated:</p>
  
  <pre><code>function importfile(fileToRead1)
  
  DELIMITER = '\t';
  HEADERLINES = 6;
  
  % Import the file
  newData1 = importdata(fileToRead1, DELIMITER, HEADERLINES);
  
  vars = fieldnames(newData1);
  for i = 1:length(vars)
       assignin('base', vars{i}, newData1.(vars{i}));
  end
  </code></pre>
  
  <p>I was thinking of doing something like this with <code>textscan</code> but am not sure how to skip the headers doing that and keep getting buffer overflow errors:</p>
  
  <pre><code>fid = fopen('scan1.dat');
  C = textscan(fid, '%*d/%*d/%*d %*d:%*d:%*d %*f %*f %f')
  fclose(fid);
  </code></pre>