Automatically arranged multiple subscripts from linear index

Functionally, the same as internal MatLab routine "ind2sub", but the result is put into an automatic

이 제출물을 팔로우합니다

sub = ind2sub1(siz, ind)

Multiple subscripts (written into one vector or matrix) from linear index "ind" for an N-dimensional array defined by its array size "siz".

Linear index "ind" can be a single positive integer or a vector of positive integers. If "ind" is a row vector, it is converted into a column vector internally.

In principle, the same as MatLab routine "ind2sub", but the result is put into an automatically sized vector (if "ind" is a single integer) or matrix (if "ind" is a vector) rather than into multiple variables.

Example:

A = ones(2, 3, 4);
Sub1 = ind2sub1(size(A), 6)

Sub1 =

2 3 1

Sub2 = ind2sub1(size(A), 4:4:24)

Sub2 =
2 2 1
2 1 2
2 3 2
2 2 3
2 1 4
2 3 4

Note: An example of its application may be found in File ID 19484.

인용 양식

Paul A.M. Bune (2026). Automatically arranged multiple subscripts from linear index (https://kr.mathworks.com/matlabcentral/fileexchange/19498-automatically-arranged-multiple-subscripts-from-linear-index), MATLAB Central File Exchange. 검색 날짜: .

카테고리

Help CenterMATLAB Answers에서 Matrices and Arrays에 대해 자세히 알아보기

일반 정보

MATLAB 릴리스 호환 정보

  • 모든 릴리스와 호환

플랫폼 호환성

  • Windows
  • macOS
  • Linux
버전 퍼블리시됨 릴리스 정보 Action
1.0.0.0