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://kr.mathworks.com/matlabcentral/fileexchange/72540-wrap-index-to-select-element-in-vector), MATLAB Central File Exchange. 검색 날짜: .
MATLAB 릴리스 호환 정보
개발 환경:
R2018a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux카테고리
Help Center 및 MATLAB Answers에서 Matrices and Arrays에 대해 자세히 알아보기
태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!