Following the advice of William Warriner, here is what can be done. Change Example_Class_2 as follows:
classdef Example_Class_2 < Example_Class_1 & matlab.mixin.CustomDisplay
properties
Property3
end
methods (Hidden)
function value = properties( obj )
propList = sort( builtin("properties", obj) );
if nargout == 0
disp(propList);
else
value = propList;
end
end
function value = fieldnames( obj )
value = sort( builtin( "fieldnames", obj ) );
end
end
methods (Access = protected)
function group = getPropertyGroups( obj )
props = properties( obj );
group = matlab.mixin.util.PropertyGroup( props );
end
end
end
Now, properties are listed in alphabetical order, both when displayed on the command line, and when returned as a cell array (with e.g. propList = properties(Example_Class_2))
Of course, you don't have to use sort() to re-order the property list in the properties method. In my case, I needed a different ordering and just used
propList = builtin("properties", obj);
propList = propList([<my custom indices order>]);