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.
Zitieren als
Greggory (2026). array2ind (https://de.mathworks.com/matlabcentral/fileexchange/32682-array2ind), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Erstellt mit
R2011a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS LinuxKategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und MATLAB Answers
Tags
Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
| Version | Veröffentlicht | Versionshinweise | |
|---|---|---|---|
| 1.0.0.0 |
