Error when appending object to empty array
5 views (last 30 days)
I am trying to form an array of a particular type of object, specifically the output model from fitdiscr, ClassificationDiscriminant.
Right now I am trying to do the following way:
model_cache = 
for i = 1:10
model = fitdiscr(...)
model_cache = [model_cache; model];
But this gives me the error
Undefined function 'throwNoCatError' for input arguments
of type 'double'.
function a = vertcat(this,varargin),
Error in main_crossvalidate_sessions (line 84)
model_cache = [model_cache;model];
Which in plain english means I cannot concatenate a double with an object ( is a double). How do I solve this issue? The way I can think of is ugly - when i = 1, model_cache = [model]; then in subsequent iterations append as usual. Are there simple solutions?