Wrap index to select element in vector

版本 2.0.0 (1.1 KB) 作者: Rubem Pacelli
Wrap index to select element in vector
27.0 次下载
更新时间 2019/8/27

查看许可证

This simple function does a circular selection (wrap the index) to select one element in a vector [1xN] or [Nx1]. It's work for negative values also.

Exemple:
A = (1:10)'

A =

1
2
3
4
5
6
7
8
9
10

wrapindex(A,12) = 2
wrapindex(A,-2) = 9

引用格式

Rubem Pacelli (2024). Wrap index to select element in vector (https://www.mathworks.com/matlabcentral/fileexchange/72540-wrap-index-to-select-element-in-vector), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2018a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Matrices and Arrays 的更多信息
标签 添加标签

Community Treasure Hunt

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

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

Fix the bug on the last element ( x(N) )

1.0.0