How i check cell in cell array is different of 0?

조회 수: 2 (최근 30일)
Mira le
Mira le 2019년 12월 8일
댓글: JESUS DAVID ARIZA ROYETH 2019년 12월 8일
for i=1:numel(T1)
if T1{i}~=0
Items=union(Items,T1{i});
end
end
~= is not for cell

채택된 답변

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019년 12월 8일
an example:
T1={{0} {4} {5} {6} {5}}
items=vertcat(T1{cellfun(@(x) ~isequal(x,{0}),T1)});
items=[items{:}];
  댓글 수: 2
Mira le
Mira le 2019년 12월 8일
편집: Mira le 2019년 12월 8일
T1 is like that
>> T1
T1 =
9×1 cell array
[1×3 double]
[1×2 double]
[1×2 double]
[1×3 double]
[1×2 double]
[1×2 double]
[1×2 double]
[1×4 double]
[1×3 double]
How I can use this function that you mentioned above
please help me
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH 2019년 12월 8일
items=cell2mat(horzcat(T1{:}));
items(items==0)=[]

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by