For Loop to read rows on a cell array

1 vue (au cours des 30 derniers jours)
Michael Angeles
Michael Angeles le 25 Jan 2022
Commenté : Michael Angeles le 28 Jan 2022
need help on the following...
key = 'BB';
data = cell(1,24);
data = {'BB'};
for i = size(data);
%compare key to each data on each column
if key = data;
%count number of elements that matches with key
counts = count how many times BB occurs
%number of elements that match divided by size of data
occurrence = counts/side of data

Réponse acceptée

David Hill
David Hill le 25 Jan 2022
Not sure if this the correct guess.
y=sum(strcmp(yourCell,'BB'),2)/size(yourCell,2);
  5 commentaires
David Hill
David Hill le 25 Jan 2022
notMatching=sum(~strcmp(yourCell,'BB'),2);
Michael Angeles
Michael Angeles le 28 Jan 2022
Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by