makesegs.m

来自「matlab下实现kaplan算法」· M 代码 · 共 41 行

M
41
字号
function startends = makesegs(times,seglength,overlap,nsegs,startskip)% startends = makesegs(times,seglength,segskip)% create a list of start and end times for use in % <segment>.  This makes all segments the same length,% and they can overlap (or if overlap is negative, skip)% if <nsegs> is specified, only the first nsegs segments will be created% <startskip> skips the first part of the dataif nargin < 5 startskip = 0;endif nargin < 4 % keep all the segments nsegs = -1; endif nargin < 3  overlap = 0;endfirst=min(times)+startskip;last = max(times)-seglength;starts = (first:(seglength-overlap):last)';ends = starts + seglength;startends=[starts,ends];if length(startends) == 0  startends = [min(times)+startskip, max(times)];  warning('Data too short for a full-length segment.  Creating a short segment.')endif nsegs >= 0  startends = startends(1:(min(length(starts),nsegs)),:);end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?