Find numeric columns in a cell array
Mostrar comentarios más antiguos
Hi,
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 understand, the only way is to do this is by
C=dataset2cell(data)
X=cell2mat(C)
However, the second command doesn't work, because C contains non-numeric columns. Is there a way to find which columns of a cell array contains only numbers? Thanks a lot,
Sergio
Respuesta aceptada
Más respuestas (1)
Pascal
el 3 de Jul. de 2014
If you know whole columns are either numeric or not,
cell2mat(C(:,find(cellfun(@isnumeric, C(1,:)))))
Categorías
Más información sobre Numeric Types en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!