Your question is not related to OOP. Look at the following:
>> c = {5, {'Hello', 'World'}, struct( 'a', 8, 'b', 9 )} ;
c = [5] {1x2 cell} [1x1 struct]
Here, c is a cell array (an array of cells).
You can index blocks of this cell array using ()-type indexing.
>> c(1:2)
ans = [5] {1x2 cell}
>> c(1)
ans = [5]
The latter is the first element of the cell array c, which is a cell in itself.
>> class( c(1) )
ans = cell
For extracting the content of this cell, you have to use {}-type indexing.
This time it (the content) is the double 5.
>> class( c{1} )
ans = double
Now indexing can be "nested"; c{2} is the content of cell #2 of the cell array c. This content is a cell array in itself, that you can again index with both () and {} whether you want cells or their content.
>> c{2}
ans = 'Hello' 'World'
>> class( c{2}(1) )
ans = cell
>> class( c{2}{1} )
ans = char
Or when the content is a struct..
>> class( c{3} )
ans = struct
>> c{3}.a
ans = 8
Hope it helps,
Cedric
Best Answer