title: how to iterate over xlsx data in octave with mixed types
body: <p>I am trying to read a simple xlsx file with xlsread in octave. Its csv version is shown below:</p>
  
  <pre><code>2,4,abc,6
  8,10,pqr,12
  14,16,xyz,18
  </code></pre>
  
  <p>I am trying to read and write the contents with this code:</p>
  
  <pre><code>[~, ~, RAW] = xlsread('file.xlsx');
  allData = cell2mat(RAW);  # error with cell2mat()
  printf('data nrows=%d, ncolms=%d\n', rows(allData), columns(allData));
  for i=1:rows(allData)
     for j=1:columns(allData)
        printf('data(%d,%d) = %d\n', i,j, allData(i,j));
     endfor
  endfor
  </code></pre>
  
  <p>and I am getting the following error:</p>
  
  <pre><code>error: cell2mat: wrong type elements or mixed cells, structs, and matrices
  </code></pre>
  
  <p>I have experimented with several variations of this problem:</p>
  
  <p>(A)  If I delete the column with the text data, ie the xlsx file contains only numbers, then this code works fine.</p>
  
  <p>(B) On the other hand, if I delete the cell2mat() call even for the purely number xlsx, I get an error during the cell access:</p>
  
  <pre><code>error: printf: wrong type argument 'cell'
  </code></pre>
  
  <p>(C) If I use cell2mat() during printf, like this:</p>
  
  <pre><code>printf('data(%d,%d) = %d\n', i,j, cell2mat(allData(i,j)));
  </code></pre>
  
  <p>I get correct data for the integers, and garbage for the text items.</p>
  
  <p>So, how can I access and print each cell of the xlsx data, when the xlsx contains mixed-type data?</p>
  
  <p>In other words, given a column index, and given that I know what type of data I am expecting there (integer or string), so how can I re-format the cell type before using it?</p>