Remove cells with spaces from cell array

1 回表示 (過去 30 日間)
Mohit
Mohit 2014 年 3 月 12 日
回答済み: Andrei Bobrov 2014 年 3 月 12 日
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!

採用された回答

Andrei Bobrov
Andrei Bobrov 2014 年 3 月 12 日
out = core_data(~cellfun(@(x)strcmp(' ',x),core_data));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by