1
我想在%this does not
行上分配向量值函數f
的結果,如下所示。有沒有辦法做到這一點?將向量值函數輸出分配給向量
文件scratch.m
:
function scratch(x)
get_f(x)
end
% vector-valued function of a vector
function val = f(x)
val(1) = x(1)^3 + x(2) - 1;
val(2) = x(2)^3 - x(1) + 1;
end
function get_f(x)
% z = f(x) % this works
[x1,x2] = f(x); % this does not
end
電話與scratch([1,1])
:
>> scratch([1,1])
Error using scratch>f
Too many output arguments.
Error in scratch>get_f (line 12)
[x1,x2] = f(x);
Error in scratch (line 2)
get_f(x)