User`s guide

Programming
24-11
Compatibility Considerations
To avoid this warning and prepare for this change, convert the cell array of strings to a
cell array of function handles.
For more information, type help function_handle and see the section entitled Note
on Backward Compatibility.
Assigning Nonstructure Variables As Structures Displays Warning
Assigning to a nonstructure variable as if it were a structure is not recommended in
MATLAB. For example, if variable x holds a double (as shown below), then attempting to
add a fieldname to it, thus converting x to a structure, is not good programming practice
and should generate an error.
x = 10;
x.name = magic(3);
Note that if x were empty (i.e., x == []), then assigning a field to it as if it were already
a structure is acceptable.
Behavior Prior to Release R14
Because of a bug in releases of MATLAB prior to R14, you can assign a field to a
nonempty, nonstructure variable in those releases without MATLAB generating a
warning message or error. The result is that MATLAB quietly converts the variable to a
structure:
x = 10;
class(x)
ans =
double
x.name = magic(3); % Invalid expression completes
% without warning or error.
class(x)
ans =
struct
Behavior In R14 and Later
In the MATLAB R14 and R14 service pack releases, you can still perform this type of
operation, but MATLAB now displays a warning message: