0

I would like to use gplotmatrix on a dataset data, which contains mixed data (numeric and strings). However, gplotmatrix works on numeric data, so I need to convert my dataset to a matrix. As far as I know, the only way is to do this is through

C=dataset2cell(data)
X=cell2mat(C) 

However, the second command throws an error, because C contains non-numeric columns. Is there a way to find which columns of a cell array are purely numeric?

Nimantha
  • 6,405
  • 6
  • 28
  • 69
DeltaIV
  • 4,773
  • 12
  • 39
  • 86
  • It works! I got the `cellfun(@isnumeric,C)` part working, but I didn't think of postprocessing it with `all`. Thanks! Any references to learn this stuff? – DeltaIV Jul 03 '14 at 13:08
  • Yes, google for "cellfun matlab", "function handle matlab", etc. :) – Divakar Jul 03 '14 at 13:11

1 Answers1

1

Use cellfun with @isnumeric function handle -

numeric_cols = find(all(cellfun(@isnumeric,C)))

Related useful pointers -

Divakar
  • 218,885
  • 19
  • 262
  • 358