0
两类:Matlab的 - 从另一个方法调用MATLAB的一种方法
classdef first < handle
methods
function hello(obj)
disp('hello ok')
obj_second.bye
end
end
end
和
classdef second < handle
methods
function bye(obj)
disp('bye ok')
end
end
end
我希望能够从obj_first调用obj_second.bye。
>> obj_first=first;
>> obj_second=second;
>> obj_first.hello
hello ok
Undefined variable "obj_second" or class "obj_second.bye".
Error in first/hello (line 5)
obj_second.bye
>>
obj_second似乎有在类“第一”,以由此类被认为是构造;你怎么看?
你可能需要后'bye'括号:代替)'obj_second.bye(' 'obj_second.bye'。 –
此外,你必须发布你的实际问题是什么。你试过什么,结果与你的期望有什么不同? –
指向'obj_second'的指针应该从哪里来,你永远不会初始化它?请描述你想要实施的行为。 – Daniel