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.
Citation pour cette source
Greggory (2026). array2ind (https://fr.mathworks.com/matlabcentral/fileexchange/32682-array2ind), MATLAB Central File Exchange. Extrait(e) le .
Compatibilité avec les versions de MATLAB
Créé avec
R2011a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS LinuxCatégories
En savoir plus sur Matrices and Arrays dans Help Center et MATLAB Answers
Tags
Découvrir Live Editor
Créez des scripts avec du code, des résultats et du texte formaté dans un même document exécutable.
| Version | Publié le | Notes de version | |
|---|---|---|---|
| 1.0.0.0 |
