function D = clabel2(C, v) h = nan(1,size(C,2)); i = 1; while i <= size(C,2) h_ = C(1,i); cnt_ = C(2,i); h(i+1:i+cnt_) = h_; i = i+cnt_+1; end for i=1:numel(v) ii_ = find(h == v(i)); if numel(ii_) == 0 continue; end i_ = round(rand() * (numel(ii_)-1)) + 1; x = C(1, ii_(i_)); y = C(2, ii_(i_)); s = sprintf('%d', v(i)); hold on; text(x,y,s); end end