Meaning of less/greater than in handle objects

조회 수: 3 (최근 30일)
Daniel Dolan
Daniel Dolan 2020년 9월 17일
댓글: Daniel Dolan 2020년 9월 17일
What is the meaning of less/greater than in handle objects? Here is a simple example.
classdef SimpleHandle < handle
end
When I create and compare two objects:
a=SimpleHandle();
b=SimpleHandle();
a > b
the result is randomly true or false.
I understand the use of == versus isqual for handle objects, but the notion of greater/less than eludes me.

채택된 답변

Bruno Luong
Bruno Luong 2020년 9월 17일
I believe the graphic handle object at one point of MATLAB history (before R2014b?) is just a double numbers unique assigned too each object.
They are used to identify the object. Matlab later replace HANDLE with a real object, but keep comparison for compatibility.
Shouldn't worry about comparing them, it's meaningless operation.
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 9월 17일
You can still double() any handle, and handle() any double (but the result might be an invalid handle.)
Daniel Dolan
Daniel Dolan 2020년 9월 17일
Numeric representations of graphic handles are still available, so I can see why inequality methods might have been implemented. There must be some kind of number associated with every object, but double(obj) only works for graphic handles, not direct subclasses of handles.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by