Function File: [ numarr, txtarr, lim ] = parsecell (rawarr)
Function File: [ numarr, txtarr, lim ] = parsecell (rawarr, limits)

Divide a heterogeneous 2D cell array into a 2D numeric array and a 2D cell array containing only strings. Both returned arrays are trimmed from empty outer rows and columns. This function is particularly useful for parsing cell arrays returned by functions reading spreadsheets (e.g., xlsread, odsread).

Optional return argument lim contains two fields with the outer column and row numbers of numarr and txtarr in the original array rawarr. Optional input argument limits can either be the spreadsheet data limits returned in the spreadsheet file pointer struct (field xls.limits or ods.limits), or the file ptr struct itself. If one of these is specified, optional return argument lim will contain the real spreadsheet row & column numbers enclosing the origins of the numerical and text data returned in numarr and txtarr.

Examples:

  [An, Tn] = parsecell (Rn);
  (which returns the numeric contents of Rn into array An and the
   text data into array Tn)
  [An, Tn, lims] = parsecell (Rn, xls.limits);
  (which returns the numeric contents of Rn into array An and the
   text data into array Tn.)

See also: xlsread, odsread, xls2oct, ods2oct.

Package: io