The closet thing I know of in MATLAB is to use a map
object. They are pretty easy to use. You can create one as follows
someMap = containers.Map();
Adding a new key is pretty easy as well
someMap('someKey') = 'someValue';
The key needs to be a string by default, but this can be edited. You can also check if the key exists already by calling
someMap.isKey('someKey')
And values are accessed by just calling
someMap('someKey')
This should mimic the behavior that you are looking for. You can always read more by looking at the documentation. containers.Map
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…