A nested structure variable for a line segment could also be created by creating structure variables for the points first, and then storing these in the two fields of a line segment variable.
For example:>> pointone = struct('x', 5, 'y', 11);
>> pointtwo = struct('x', 7, 'y', 9);
>> myline = struct('endpoint1', pointone, ...
'endpoint2', pointtwo)
myline =
endpoint1: [1x1 struct]
endpoint2: [1x1 struct]