< Cell 에 관한 것들 >
Ref : http://stackoverflow.com/questions/3400515/how-do-i-detect-empty-cells-in-a-cell-array
1. Cell에서 empty 부분 없애는 방법
%# find empty cells emptyCells = cellfun(@isempty,a); %# remove empty cells a(emptyCells) = [];
Note: a(i)==[]
won't work. If you want to know whether the the i-th cell is empty, you have to use curly brackets to access the content of the cell. Also, ==[]
evaluates to empty, instead of true
/false
, so you should use the command isempty
instead. In short: a(i)==[]
should be rewritten as isempty(a{i})
.
==================================================================================
2. Cell에서 empty 부분 확인해서 찾는 함수 : isempty
>> help isempty
isempty True for empty array.
isempty(X) returns 1 if X is an empty array and 0 otherwise. An
empty array has no elements, that is prod(size(X))==0.
X가 하나의 empty array 이여만 가능하지 empty와 non-empty가 섞여있는 경우라면 isempty가 전부다 0만 나옴... 거지같네;;;
==================================================================================