array2ind

バージョン 1.0.0.0 (1.54 KB) 作成者: Greggory
A modification of the built-in sub2ind.
ダウンロード: 208
更新 2011/8/25

ライセンスの表示

Usage:

ind = array2ind(SIZE, COORDINATES_AS_ARRAY)

Example:

g = magic(5);
ind = array2ind([5 5], [3 2])
g(ind)

returns the same value as if you had called

g(3,2)

Useful for when the coordinates for a matrix element are stored as an array and avoids the current method of:

b = [3 2];
g(b(1), b(2))

While this is suitable for some cases, it's not generalized or adaptable to changing sizes of b and g.

引用

Greggory (2026). array2ind (https://jp.mathworks.com/matlabcentral/fileexchange/32682-array2ind), MATLAB Central File Exchange. 取得日: .

MATLAB リリースの互換性
作成: R2011a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersMatrices and Arrays についてさらに検索
バージョン 公開済み リリース ノート
1.0.0.0