Reputation: 2150
I am calling the function like so:
beta=NaN(size(rates,1),6);
mats=[1:50];
mats2=[2 5 10 30];
for i=1:2
y2=rates(i,mats2);
yM=rates(i,:);
dataList=struct('yM',yM,'mats',mats,'model',@NSS,'mats2',mats2,'y2',y2);
de=struct('min',[0;3.5],'max',[3.5;30],'d',2,'nP',200,'nG',600,'ww',0.1,'F',0.5,'CR',0.99,'R',0,'oneElementfromPm',1);
beta(i,:)=DElambdaVec(de,dataList,@OF);
end
However the output from DElabdavec, is a cell array:
output.Fbest=Fbest; output.xbest=xbest; output.Fbv=Fbv;
How can I store each of these items on each pass of the for loop?
Upvotes: 0
Views: 81
Reputation: 11810
You can save the results to a cell array - beta in this case:
beta{i} = DElambdaVec(de,dataList,@OF);
Every element of beta
is now an object returned by DElambdaVec
, e.g.:
beta{1}
ans =
Fbest: 'Fbest'
xbest: 'xbest'
Fbv: 'Fbv'
I used example values to create the entries here.
Note that you have to initialize beta=[]
before the loop.
Upvotes: 1