Causes: Load as struct Instead of Object
If you add a new named value or a new property to a class after saving an enumeration,
MATLAB does not warn during load.
If the changes to the enumeration class definition do not prevent MATLAB from loading
the object (that is, all the named values in the MAT-File are present in the modified class
definition), then MATLAB issues a warning that the class has changed and loads the
enumeration.
In the following cases, MATLAB issues a warning and loads as much of the saved data as
possible as a struct:
- MATLAB cannot find the class definition
- The class is no longer an enumeration class
- MATLAB cannot initialize the class
- There is one or more enumeration members in the loaded enumeration that is not in
the class definition - If the class is a value-based enumeration with properties and a property that exists in
the file, is not present in the class definition
struct Fields
The returned struct has these fields:
- ValueNames — A cell array of strings, one per unique value in the enumeration array.
- Values — An array of the same dimension as ValueNames containing the
corresponding values of the enumeration members named in ValueNames. Depending
on the kind of enumeration class, Values can be one of the following:- If the enumeration class derives from a built-in class, the array class is the same as
the built-in class. The values in the array are the underlying values of each
enumeration member. - Otherwise, a struct array representing the property name — property values
pairs of each enumeration member. For simple and handle-based enumerations, the
struct array has no fields.
- If the enumeration class derives from a built-in class, the array class is the same as
- ValueIndices — a uint32 array of the same size as the original enumeration. Each
element is an index into the ValueNames and Values arrays. The content of
ValueIndices represents the value of each object in the original enumeration array.
14 Enumerations