RolandRitt/Matlab-NestedMap

Versione 1.4.0.0 (4,97 KB) da Roland
MapNested is a subclass from 'containers.map' which implements nested maps (easy multi-key access)
270 download
Aggiornato 8 lug 2017

Matlab-NestedMap
Matlab implementation for nested maps (map of maps). This class implements easy set and get access for multible keys. The syntax is the following: Generate a new MapNested object:
NMapobj = MapNested(); %generate a new object
Write values to the Map (2 possibilites):

%possibility 1 syntax:
NMapobj('key1', 'key2', 'key3') = 10; %assign value 10 to the keyList
NMapobj({'key1', 'key2', 'key4'}) = 5; %assign value 5 using a cell array for the keyList

%possibility 2 - use the 'setValueNested' function
NMapobj = setValueNested(NMapobj, {key1, key2, key3}, 10);
NMapobj = setValueNested(NMapobj, {key1, key2, key4}, 5);
Retrieve values from the Map (2 possibilites):

%possibility 1:
value1 = NMapobj(key1, key2, key3); %returns '10'
value2 = NMapobj({key1, key2, key4}); %return '5'

%possibility 2 - using 'getValueNested' - function
value1 = getValueNested(NMapobj ,{key1, key2, key3}); %returns '10'
value2 = getValueNested(NMapobj ,{key1, key2, key4}); %returns '5'
Call superclass Methods (see containers.Map: eg isKey, keys, length, remove, size, values):

NMapobj.superclassMethod()
Retrieve properties (see containers.Map: eg. Count, KeyType, ValueType):

NMapobj.property
Delete Entries:

NMapobj('Key') = [];
remove(NMapobj, 'Key');
This function is a subclass from Matlabs 'containers.map'-class:

ATTENTION: Cell-arrays can not be assigned to the map

NMapobj('key1', 'key2', 'key3') = {'a', 'cell', 'array'}; %throws error see: https://github.com/RolandRitt/Matlab-NestedMap

Cita come

Roland (2024). RolandRitt/Matlab-NestedMap (https://github.com/RolandRitt/Matlab-NestedMap), GitHub. Recuperato .

Compatibilità della release di MATLAB
Creato con R2016b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Dictionaries in Help Center e MATLAB Answers

Community Treasure Hunt

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

Start Hunting!

Le versioni che utilizzano il ramo predefinito di GitHub non possono essere scaricate

Versione Pubblicato Note della release
1.4.0.0

implemented 'isKey' method, to enable if a nested key is in the map, eg,:
*) M.isKey({Key1, Key2, Key3})
*) M.isKey(Key1, Key2, Key3)

1.3.0.0

remove entries by assinging empty array implemented:

1.2.0.0

Add '.' subsref for calling superclass-methods and properties

1.1.0.0

changed the class descripion and extended the test file

1.0.0.0

Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.
Per visualizzare o segnalare problemi su questo componente aggiuntivo di GitHub, visita GitHub Repository.