title: Generate Cell Array of Multiple Rows and Columns From Text File
body: <p>I have a text file formatted like this:</p>
  
  <pre><code>ab cd ef gh ij
  ab cd ef gh ij
  ab cd ef gh ij
  </code></pre>
  
  <p>How can I import this data into Matlab so that it is stored as a <code>cell array</code> that is equivalent to this 3x5 <code>cell array</code>:</p>
  
  <pre><code>C = {
      ['ab'], ['cd'], ['ef'], ['gh'], ['ij'];
      ['ab'], ['cd'], ['ef'], ['gh'], ['ij'];
      ['ab'], ['cd'], ['ef'], ['gh'], ['ij'];
      };
  </code></pre>
  
  <p>I can modify the text file to contain some sort of "end-of-line" indicator if needed.  I tried using <code>textscan</code>, but can't figure out how to get it to format the variable as described.</p>
  
  <p>EDIT: Changed the accepted answer; I like the handling of potentially missing data points in Divakar's answer.</p>