I don't really know how to explain what I'm after without an example. I guess the title could be better but I'm not sure how to describe the issue.
I've got the following function
function [x,y] = f(z) z = 3; x = z.*[2;1]; y = z.*[1 2; 3 4]; end
Now I want to use f(z) as a function handle in the next function as the input "func" and I want x and y back from f(z) to use separately in the 2nd function.
function a = h(func, b) [x,y] = func; b = 2; a = b.*y; end
But I get the following error when trying to do so
>> h(f(3),2) Too many output arguments. Error in h (line 2) [x,y] = func;
How do I get x and y back separately? This doesn't seem to be working.
[x,y] = func;
I also tried:
x = func(1) y = func(2)
but this assigns x to the first index of x and y to the 2nd index of x. How do I get it to do what I want, whilst keeping the input name as "func" and using f(z) which returns 2 outputs?