Nested Structures:
The nested structure is a structure in which at least one of the members is itself a structure.
For illustration, a structure for the line segment may consist of fields presenting the two points at the ends of the line segment. Each of these points would be presented as a structure consisting of the x- and y-coordinates.
This represents a structure variable known as lineseg which has two fields, end-point1 and endpoint2. Each of these is a structure having two fields, x & y.
The one method of defining this is to nest calls to the function struct:
>> lineseg = struct('endpoint1',struct('x',2,'y',4), . . .
'endpoint2',struct('x',1,'y',6))