reading out a cell array which is the value of a dictionary in matlab

Assuming you have a cell array stored as a value in your dictionary, you can read out the cell array using indexing. The following code example shows how to read out the first element of the cell array stored as the value of the key 'myKey' in the dictionary 'myDict':

main.m
% create an example dictionary with a cell array as value
myDict = containers.Map;
myDict('myKey') = {'apple', 'banana', 'cherry'};

% read out the cell array using indexing
myArray = myDict('myKey'); % get the cell array from the dictionary
myElement = myArray{1}; % get the first element of the cell array
308 chars
8 lines

In this example, myDict('myKey') retrieves the cell array from the dictionary, and myArray{1} retrieves the first element of this cell array. You can replace 1 with any valid index to read out any other element from the cell array.

gistlibby LogSnag