使用图形句柄,您可以执行以下操作:
>> a = nan(1,5)
a =
NaN NaN NaN NaN NaN
>> a(3) = line([1 2],[1 2])
a =
NaN NaN 0.0042 NaN NaN
>> find(~isnan(a),1,'first')
ans =
3
如果这是使用普通句柄派生类完成的,则会发生此错误:
>> a(3) = MyObject(1,1,1)
The following error occurred converting from MyObject to double:
Error using double
Conversion to double from MyObject is not possible.
据我了解,图形句柄只是双打。自定义对象也可以这样表现吗?