你看这样行吗?
% A 中元素在 B 中*出现*的次数,重复出现,重复计数
clc; clear all;
A = [1 3 5 135 7 9];
B = 1:10;
isIn = [];
for i = 1:size(A, 2)
tmp = 0;
tmp = ~isempty(find(B == A(i), 1))
isIn = [isIn tmp];
end
isIn
sum(isIn)
你看这样行吗?
% A 中元素在 B 中*出现*的次数,重复出现,重复计数
clc; clear all;
A = [1 3 5 135 7 9];
B = 1:10;
isIn = [];
for i = 1:size(A, 2)
tmp = 0;
tmp = ~isempty(find(B == A(i), 1))
isIn = [isIn tmp];
end
isIn
sum(isIn)