要使用abs(A),A必须是实数或复数矩阵。下面是不使用循环而实现你目的的代码,MATLAB里最好少用或不用循环结构。id1 = abs(y1)>= abs(y2);id2 = abs(y1)< abs(y2);y3(id1)= y1(id1);y3(id2)= y2(id2)
if nargin<3 %nargin定义在用户自定义函数体内,nargin返回 %用来调用函数的变量的个数。 dir='cw'; end if nargin<2 conn=8; end L=bwlabel(BW,conn); %返回值是矩阵L,大小同BW,包含了BW中的连通部分的标记 %The number of objects is the maximum value of L.Initialize the cell %array(元包数组)B...