Anomaly with the number 32??
古いコメントを表示
I am using this line to determine if an element of a cell array is empty:
tf = isequal({' '}, Array(row,col));
When
Array(row,col) = 32
tf returns 1, which should actually be 0. Why is this happening?
採用された回答
その他の回答 (1 件)
Arturo Moncada-Torres
2011 年 8 月 11 日
To know if a cell array is empty, I would recommend you to do the following:
myEmptyCells = cellfun(@isempty,cellArray);
As to this strange conduct, sometimes cell arrays can be tricky. I recommend you to read this great post by Loren regarding them.
3 件のコメント
Nathan McCaughey
2011 年 8 月 11 日
Arturo Moncada-Torres
2011 年 8 月 12 日
It would work anyway. If you want to use it with _isequal_ you can do something like this:
a{1} = 1;
a{2} = 'hello';
a{3} = '';
a{4} = 45;
b = cell(1,4);
myEmptyCells = cellfun(@isequal, a, b);
Jan
2011 年 8 月 13 日
BTW, cellfun('isempty') is much faster than cellfun(@isempty)!
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!