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)