I'm trying to run the code below but I keep getting the "Conversion to double from struct is not possible" error over and over. I'd really appreciate it if you could help me with what's wrong with the code. The screenshot of the error is attached.
H = [1,2,3, 4, 5, 6, 7, 8, 9, 10];
ratio = [.6 .2 .2; .7 .15 .15; .8 .1 .1];
result = zeros(30,1);
counter = 1;
load('inputsKonyaAccesshistoricalTransposeAnn.mat');
load('reanalizKonyaprecipitationhistorical.mat');
I1= inputsKonyaaccessTransposehist';
T= reanalizKonyahistprecipitation';
xdata2=(1:size(I1,1))';
dasddas = bsxfun(@(x,y) interp1(y(~isnan(x)),x(~isnan(x)),y),I1,xdata2);
I = dasddas;
for h_counter = 1:length(H)
for r_counter = 1:3
result(counter) = train_netloop(H(h_counter),ratio(r_counter,:),I,T);
counter = counter 1;
end
end
CodePudding user response:
Well, apparently the output of train_netloop()
is a structure, which you're trying to save in an array you created with zeros()
, i.e. a double-array. Since a structure is not a double, this obviously won't work. Try result = cell(30, 1)
and result{counter} = train_netloop()
, i.e. storing the results in cells.