Passing variables into function (MATLAB)

49 Views Asked by At

I am creating a function that perform multiple regression in MATLAB. The function is created as

function [Beta] = george_linreg(y,x1,x2,x3,....,xN).

I don't know before hand how many explanatory variables there will be $\bf(x_i)$. How do I go about creating a function where any number of $\bf(x_i)$ can be inputted?

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

Check out the documentation on nargin and varargin.