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.
Citar como
Greggory (2026). array2ind (https://la.mathworks.com/matlabcentral/fileexchange/32682-array2ind), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2011a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Más información sobre Matrices and Arrays en Help Center y MATLAB Answers.
Etiquetas
Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
| Versión | Publicado | Notas de la versión | |
|---|---|---|---|
| 1.0.0.0 |
