The problem arises when I try to use MATLAB to process objects as key values ββin MATLAB. Map .
ld( h1, h2 ) defines a linear order for descriptor objects; therefore, there should be no restriction on the use of descriptor objects as key values ββfor cards; however, only integer or string types are allowed.
A workaround for this problem could be to extract the actual identifiers (addresses) of the handle objects (which are mostly compared in the ld function).
So the question is: how do I get the handle object identifier?
It has been found that a workaround can be made using constant variables in static member functions.
In this case, you should inherit all your classes from the base class as follows.
classdef object < handle properties ( GetAccess = 'public', SetAccess = 'private' ) id end methods ( Access = 'protected' ) function obj = object() obj.id = object.increment(); end end methods ( Static, Access = 'private' ) function result = increment() persistent stamp; if isempty( stamp ) stamp = 0; end stamp = stamp + uint32(1); result = stamp; end end
end
source share