I have defined a simple class called MySettings, which internally holds for others settings defined in a class called MySubSettings:
%% --- Definition for MySubSettings
classdef MySubSettings < handle
properties
Fifi = 666;
end
end
%% --- Definition for MySettings
classdef MySettings < handle
properties
Riri = 42;
Subs = MySubSettings();
end
end
The first time I instantiate MySettings with s = MySettings(); everything is ok (Property Riri is initialized to 42 and Subs is an instance of MySubSettings with property Fifi initialized to 666) ... So far so good ...
Now if I modify property values and reassign s to new instance like this:
s.Riri = 0;
s.Subs.Fifi = 0;
s = MySettings();
Then inspecting new values for properties in new s instance ... I have s.Riri which is equal to 42 (as expected) ... but s.Subs.Fifi is still equal to 0 where I would have expected it to be reinitialized to 666 (???)
Why only Riri is initialized ? Am I doing something wrong or is it a bug ?
Note: I have the issue with R2013b and R2014b.