在我的项目中,我使用两个类——行和三角形。类行在其函数中创建三角形类对象:
classdef row < handle
% some parameters here
methods
% constructor and some other functions here
function [T1 T2] = createFoR(obj, hT, Alpha, Beta, DeltaAlpha, DeltaBeta)
% creating P1 matrix (irrelevant, its 100% correct)
T1 = triangle(P1);
% creating P2 matrix (irrelevant, its 100% correct)
T2 = triangle(P2);
end
end
当我像这样调用这个行类函数时:
[T1 T2] = Row1.createFoR(T(1,1), Alpha, Beta, DeltaAlpha, DeltaBeta);
或像这样:
[T(2,1) T2] = Row1.createFoR(T(1,1), Alpha, Beta, DeltaAlpha, DeltaBeta);
一切正常。但是当我尝试将两个返回的三角形对象分配给这样的数组单元格时:
[T(2,1) T(2,2)] = Row1.createFoR(T(1,1), Alpha, Beta, DeltaAlpha, DeltaBeta);
我收到此错误:
Error using triangle (line 10)
Not enough input arguments.
Error in test (line 20)
[T(2,1) T(2,2)] = Row1.createFoR(T(1,1), Alpha, Beta, DeltaAlpha, DeltaBeta);
我可以请你解释一下我做错了什么吗?