For Loop to read rows on a cell array

2 ビュー (過去 30 日間)
Michael Angeles
Michael Angeles 2022 年 1 月 25 日
コメント済み: Michael Angeles 2022 年 1 月 28 日
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

採用された回答

David Hill
David Hill 2022 年 1 月 25 日
Not sure if this the correct guess.
y=sum(strcmp(yourCell,'BB'),2)/size(yourCell,2);
  5 件のコメント
David Hill
David Hill 2022 年 1 月 25 日
notMatching=sum(~strcmp(yourCell,'BB'),2);
Michael Angeles
Michael Angeles 2022 年 1 月 28 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Translated by