MATLAB: Assigning a vector to a function

function

I made a function that returns a vector as a response. I noticed that this vector is not 'stored' as I check the workspace. So I attempted to say A = FUNCTION(X,Y). But it returned 'ERROR USING FUNCTION. TOO MANY OUTPUT ARGUMENTS'.
I want to store the response given by the function in a vector so I can use it in the future. How do i do this?
Thanks

Best Answer

It seems that you have not defined your function properly.
In an m-file called myfun.m you write
function A = myfun(X,Y)
A = X + Y; % or whatever the function should compute
Then you call it using, e.g.,
a = myfun(x,y);
See also
help function