📄 killisol.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -