Individual structure variable:
The individual structure variable for one software package may look like this:
The name of the structure variable is a package; it has four fields that are: item_no, cost, price, and code.
The one way to initialize the structure variable is to use struct function that preallocates the structure. The field names are passed to struct in the quotes, following every one with the value for that field:
>> package = struct('item_no',123,'cost',19.99,. . .
Typing the name of structure variable will show the names and contents of all the fields:
Note that in the Workspace Window, the variable package is scheduled as 1 × 1 struct. The MATLAB, as it is written to work with the arrays, supposes that the array format.Merely as a single number is treated as 1 × 1 double, a single structure is considered as a 1 × 1 struct.