Borrar filtros
Borrar filtros

comparing string with cell from table

1 visualización (últimos 30 días)
Eliah Verbeemen
Eliah Verbeemen el 24 de Mayo de 2018
Comentada: Jan el 26 de Mayo de 2018
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]

Respuestas (1)

Jan
Jan el 24 de Mayo de 2018
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 comentarios
Eliah Verbeemen
Eliah Verbeemen el 24 de Mayo de 2018
Editada: Eliah Verbeemen el 25 de Mayo de 2018
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 el 26 de Mayo de 2018
Please post the contents of the tables.

Iniciar sesión para comentar.

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by