index.m - create a list of the indices and values of an array

Create a list where each value (content) of an array is displayed together with its index.
1,1K Descargas
Actualizado 26 may 2009

Ver licencia

This function displays each value of an array together with its index. It is possible to ignore zeros and/or NaNs and/or to sort the list according to value. The values can be integers or floating point numbers.

EXAMPLES:

>> a=[2,3,NaN;1,2,4;7,0,9];

>> index(a,'sorted')

ans =
3 2 0
2 1 1
1 1 2
2 2 2
1 2 3
2 3 4
3 1 7
3 3 9
1 3 NaN

>> index(a,'sorted','nonans','nozeros')

ans =
2 1 1
1 1 2
2 2 2
1 2 3
2 3 4
3 1 7
3 3 9

Citar como

Georg Stillfried (2024). index.m - create a list of the indices and values of an array (https://www.mathworks.com/matlabcentral/fileexchange/21330-index-m-create-a-list-of-the-indices-and-values-of-an-array), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2007b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Matrix Indexing en Help Center y MATLAB Answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.1.0.0

faster through ind2sub

1.0.0.0

improved speed for large arrays