0

I have 2 sets (X and Y) of 9x714 cell arrays where inside the cells consist of various dimension of matrices and empty ones. Cell array X and Y are symmetrical for matrix dimensions. I would like to use cellfun to apply lasso regression.

[B FitInfo] = cellfun(lasso(X, Y,'CV',4,'Alpha',1));

The response received from Matlab:

"Error using lasso (line 221). The parameter 'X' must be a real-valued 2D matrix."

All of the matrices inside the cell are real-values. The above function works when run individually by specifying the cell location, for example:

[B FitInfo] = lasso(X{9, 1}, Y{9, 1},'CV',4,'Alpha',1));

Note: the above function is run in single, not using loops.

Please advise. Thank you in advance.

Ramesh-X
  • 4,853
  • 6
  • 46
  • 67
Riano
  • 1
  • Your call to `cellfun` has only one parameter. According to the [documentation](https://www.mathworks.com/help/matlab/ref/cellfun.html), it takes at least two: the function and the cell array(s) to iterate over. – beaker Jul 23 '17 at 00:56
  • Would you please provide some examples. Thank you and much appreciated. – Riano Jul 23 '17 at 18:11

0 Answers0