title: How to read text fields into MATLAB and create a single matrix
body: <p>I have a huge CSV file that has a mix of numerical and text datatypes.  I want to read this into a single matrix in Matlab.  I'll use a simpler example here to illustrate my problem.  Let's say I have this CSV file:</p>
  
  <pre><code>1,foo
  2,bar
  </code></pre>
  
  <p>I am trying to read this into MatLab using:</p>
  
  <pre><code>A=fopen('filename.csv');
  B=textscan(A,'%d %d', 'delimiter',',');
  C=cell2mat(B);
  </code></pre>
  
  <p>The first two lines work fine, but the problem is that texscan doesn't create a 2x2 matrix; instead it creates a 1x2 matrix with each value being an array.  So I try to use the last line to combine the arrays into one big matrix, but it generates an error because the arrays have different datatypes.</p>
  
  <p>Is there a way to get around this problem?  Or a better way to combine the arrays?</p>