ENUMARRAY

An array that inherits from class DOUBLE and allows a user to index elements using an enumerated typ

Al momento, stai seguendo questo contributo

ENUMARRAY inherits from class double, but allows a user to index into the array using enumerated indices (i.e. strings) rather than numerical indices. Inputs are the array data, an MxNxPx... double array containing the data, and cell arrays of strings used to index into the data.
The created object can be referenced using strings or numeric indices.

Comments and reports of bugs are welcome.

Example:

data = repmat((1:10)',1,6) + repmat([10 20 30 40 50 60],10,1);

ind1 = {'one','two','three','four','five','six','seven','eight','nine','ten'};

ind2 = {'red','orange','yellow','green','blue','purple'};

EA = enumarray(data,ind1,ind2)

EA('one','red')

ans =

11

See the comments for more detailed examples. Note that due to the use of OOP, the earliest version of MATLAB for which this works is R2008a.

Cita come

Jen (2026). ENUMARRAY (https://it.mathworks.com/matlabcentral/fileexchange/21488-enumarray), MATLAB Central File Exchange. Recuperato .

Informazioni generali

Compatibilità della release di MATLAB

  • Compatibile con qualsiasi release

Compatibilità della piattaforma

  • Windows
  • macOS
  • Linux
Versione Pubblicato Note della release Action
1.1.0.1

Updated license

1.1.0.0

Add support for colon operator (:) and single column/row retrieval. (ie ds(:,'col1') )

1.0.0.0