title: Matlab read text file to cell array
body: <p>I want to read some data from a text file but I don't know how to do this.
  I know that I can read text files like this</p>
  
  <pre><code>fid=fopen('data.txt');
  A = textscan(fid,'%s')
  </code></pre>
  
  <p>which returns</p>
  
  <pre><code>A =
  {
    [1,1] =
    {
      [1,1] = drink
      [2,1] = water
      [3,1] = drink
      [4,1] = eat
      [5,1] = drink
      [6,1] = spoon
      [7,1] = water
      [8,1] = drink
      [9,1] = water
      [10,1] = drink
    }
  }
  </code></pre>
  
  <p>the text file looks like this</p>
  
  <pre><code>drink water drink
  eat drink spoon
  water drink water drink
  </code></pre>
  
  <p>But I want to store the data in a cell array like this</p>
  
  <pre><code>A =
  {
    [1,1] =
    {
      [1,1] = drink
      [1,2] = water
      [1,3] = drink
    }
    [1,2] =
    {
      [1,1] = eat
      [1,2] = drink
      [1,3] = spoon
    }
    [1,3] =
    {
      [1,1] = water
      [1,2] = drink
      [1,3] = water
      [1,4] = drink
    }
  }
  </code></pre>
  
  <p>How can i solve this?</p>