MATLAB: Error using @regress fuction

functionMATLAB and Simulink Student Suitematlab functionregressiontable

Hello, I am trying to create a function as follows with a set of variables that I get from a table named Change1:
X = [Change1.Ones Change1.ReturnsMarket]
func = @regress(Change1.ReturnsCleaned,X);
However, everytime I get the following error message:
Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for
mismatched delimiters.
Thank you all for your help !

Best Answer

Try this:
func = @(Q)regress(Q,X);
then call it as:
[b,bint] = func(Change1.ReturnsCleaned);
(It seems a bit inefficient to me to wrap regress in an anonymous function. Personal opinion only.)