mep: a pedestrian vector index list creator

版本 1.0.0.0 (2.2 KB) 作者: us
Creates epochs (0|1) in a logical array according to a list of indices (begin:end).
6.5K 次下载
更新时间 2003/5/21

查看许可证

creates - completely vectorized - a logical array/vector <lvec> with epochs/intervals set to <1|TRUE> according to a list of indices of the form:
begin = [b1 b2 ... bN]
end = [e1 e2 ... eN]
where <b>s and <e>s may overlap or be included within each other.
lvec=[b1:e1 b2:e2 ... bN:eN]
itself can be used to retrieve/assign values from a numerical construct, eg,
vec(1,2,lvec)=nan;

help mep
vix = mep(v,ixb,ixe)
vix = mep(v,[ixb;ixe])
to create epochs

returns in VIX a <logical> array with epochs set to
true: ixb(1)->ixe(1) ... ixb(N)->ixe(N)
false: otherwise
correctly handles epoch overlaps/inclusions/reversals

v: vector (to size VIX, is not changed)
ixb: list of indices BEGIN epoch
ixe: list of indices END epoch

% examples
z=zeros(1,10);
vix=mep(z(1,:),[1 5],[3 10]);
z(1,vix)=1
% 1 1 1 0 1 1 1 1 1 1
z=zeros(1,10);
vix=mep(z(1,:),[2 3 2 6 9],[2 3 4 7 10]);
z(1,vix)=1
% 0 1 1 1 0 1 1 0 1 1
z='----------';
vix=mep(z,[[1 3 6];[4 4 8]]);
z(vix)='+'
% ++++-+++--

引用格式

us (2024). mep: a pedestrian vector index list creator (https://www.mathworks.com/matlabcentral/fileexchange/2479-mep-a-pedestrian-vector-index-list-creator), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0

enhanced help