oop - Can you obtain an unique identifier for a MATLAB object? -
i debugging matlab code, , want make sure 2 references object referring same object. there way obtain unique identifier objects (such memory address)?
as far know not able add own ids objects, matlab random number streams.
if using oop add property id , set during construction of object.
java.rmi.server.uid() nice way obtain unique id's
however testing == check actual handles, more of usability issue.
classdef yourclass < handle properties id end methods function obj = yourclass() obj.id = java.rmi.server.uid(); end end end it rather simple check objects.
Comments
Post a Comment