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?

2
  • 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? Commented Jul 3, 2014 at 13:08
  • Yes, google for "cellfun matlab", "function handle matlab", etc. :) Commented Jul 3, 2014 at 13:11

1 Answer 1

1

Use cellfun with @isnumeric function handle -

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

Related useful pointers -

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.