matlab: cell元胞数组去重

参考 真棒

%cell元胞数组去重
function D=cellUnique(x)
    D = x;
    count1 = 1;count2 =1; 
    while(count1<= size(D,1)) 
        count2 = count1+1; 
        while(count2<=size(D, 1)) 
            if(isequal(D{count1}, D{count2})) 
                D(count2) = [];
                count2 = count2 -1; 
            end 
            count2= count2+1;
        end 
        count1 = count1+1; 
    end
end

你可能感兴趣的:(Matlab,matlab)