Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Could anyone help me to count the number of elements present in each row are different.

2 ビュー (過去 30 日間)
jaah navi
jaah navi 2020 年 1 月 31 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have two different cells A and B containing the data as follows:
A=10X1 cell
'four'
'four'
'two'
'four'
'four'
'two'
'two'
'one'
'four'
'four'
B=10X1 cell
'three'
'four'
'two'
'four'
'three'
'four'
'two'
'two'
'four'
'three'
I want to compare each row of A and B is same.If they are same i need to consider it by dividing it by the total number of data(10).
could anyone please help me on it.

回答 (1 件)

Bhaskar R
Bhaskar R 2020 年 1 月 31 日
result = cellfun(@(x,y)strcmp(x,y), A, B)/numel(A);
  3 件のコメント
Bhaskar R
Bhaskar R 2020 年 1 月 31 日
result = find(cellfun(@(x,y)strcmp(x,y), A, B))/numel(A);
jaah navi
jaah navi 2020 年 1 月 31 日
i got the result form the following code:
result=cellfun(@isequal, A,B);
result1=sum(result==0,1) ;
result2=result1/numel(A);
Anyway thanks for your help.

Community Treasure Hunt

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

Start Hunting!

Translated by