killisol.m
来自「matlab下实现kaplan算法」· M 代码 · 共 34 行
M
34 行
function nlabels = killisol(labels, nconseq, goodlabel)% nlabels = killisol(labels, nconseq, goodlabel)% find any islands of not <goodlabel> labels that is% smaller or equal to nconseq% pad the data with a zero. Later, this will kill off trailing oneslabels = [labels(:);0];nlabels = labels;% find the bad labelszs = find(labels ~= goodlabel);% find the indices of these in our original datagoo = 1:length(labels);goo = goo(zs);% find the lengths of segments between bad labelslens=diff( [0;goo(:)]) -1;% find the short segmentsfoo = find(lens <= nconseq & lens > 0);% changes isolated labels to badlabelsfor k=1:length(foo) koo = goo(foo(k)); for j=1:(lens(foo(k))) nlabels(koo-j) = 0; endend nlabels = nlabels(1:(length(nlabels)-1));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?