tags:

views:

46

answers:

1

I wrote the following function

% e is n×1 and y is n×1 vectors
function z=e_rand(e,y)
         b_LS=regress(e,y)
         z=b_LS*5

I saved the function in MATLAB toolbox. But when I run the function I get the following error: input argument "e" is undefined

How can I create the function correctly?

+5  A: 

You DON'T RUN a function. You use it in an expression. You call your function at the command line. But you don't use the run command on a function. Run is only for scripts, not functions.

At the command line, just type this:

z = e_rand(e,y);
woodchips

related questions