Wrap index to select element in vector

バージョン 2.0.0 (1.09 KB) 作成者: Rubem Pacelli
Wrap index to select element in vector
ダウンロード: 28
更新 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 (2025). 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 Center および MATLAB AnswersMatrices 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