求矩阵的模: function count = juZhenDeMo(a,b) [r,c] = size(a);%求a的行列 [r1,c1] = size(b);%求b的行列 count = 0; for j=1:r-r1+1%所求的行数中取 for i=1:c-c1+1%所有的列数中取 d = a(j:j+r1-1,i:i+c1-1); e = double(d==b); if(sum(e(:))==r1*c1) count = count + 1; end end end<pre name=