필터 지우기
필터 지우기

comparing string with cell from table

조회 수: 1 (최근 30일)
Eliah Verbeemen
Eliah Verbeemen 2018년 5월 24일
댓글: Jan 2018년 5월 26일
I like to find how many times the word TC is present is column 4 of the table data. The counter stays on zero. Can someone pleae tell me why? I wrote this code:
for YY=1:z
TC{1,YY} = (0);
[rowX, columnY] = size(data{1,YY} );
for qq = 1:rowX
vvv{1,1} = data{1,YY}(qq,4);
Index2{1,1} = strcmp(vvv{1,1}(1,1), 'TC');
if Index2{1,1}==1
TC{YY} = TC{YY}+1;
end
end
end
[EDITED, Jan, Code formatted]

답변 (1개)

Jan
Jan 2018년 5월 24일
What is "data"?
What about:
TC = zeros(1, size(data, 2));
for YY = 1:size(data, 2)
col4 = data{1, YY}(:, 4);
TC(YY) = sum(strcmp(col4, 'TC'));
end
  댓글 수: 2
Eliah Verbeemen
Eliah Verbeemen 2018년 5월 24일
편집: Eliah Verbeemen 2018년 5월 25일
data is a cell array containing z tables. I liked to search in each of this tables. You can replace YY by one if you like. TC stays on 0.
Jan
Jan 2018년 5월 26일
Please post the contents of the tables.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by