Search and delete row from cell array
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a m x n cell array. I want to search the 6th column for empty cells and delete the entire row with the emtpy cell.
댓글 수: 0
답변 (2개)
Hugo
2013년 6월 12일
Suppose that C is your cell array
Cnew=C; %Just for not losing original values
Cnew(cellfun(@(x)isempty(x),C(:,6)),:)=[];
Does this work for you?
댓글 수: 0
Youssef Khmou
2013년 6월 12일
try this example :
% gievn your cell C
%A=cell2mat(C);
% simulating your data
A=randn(10);
A(4,6)=0; % zero
A(7,6)=0; % zero
B=A(:,6); % the 6th column
[index]=find(B==0);
% deleting the corresponding rows
A(index)=[];
C=mat2cell(A);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!