Remove cells with spaces from cell array

3 Ansichten (letzte 30 Tage)
Mohit
Mohit am 12 Mär. 2014
Beantwortet: Andrei Bobrov am 12 Mär. 2014
Hi,
I am trying to remove cells with just a space in them (and no other text or number) from a cell array (100 by 200) but am unable to do so with below command as I get error.
core_data(cell2mat(core_data)==' ')=[];
??? Error using ==> cell2mat at 47
All contents of the input cell array must be of the same data type.
My cell array has strings as well as numeric data. Please help!

Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 12 Mär. 2014
out = core_data(~cellfun(@(x)strcmp(' ',x),core_data));

Weitere Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by