How can I generate a matrix of results and the indices and of nested loops whose indices are vectors?

My code looks something like this:
day1=0
day2=0
for d=datevector1
day1=day1+1
% find rows with date d in a certain column
for t =datevector2
day2=day2+1
% find rows with date t in another column
%then use fmincon
[result(day1,day2)]=fmincon(objFun,0.01,[],[],[],[],-0.05,0.05,[],options);
end
end
I use day1 and day2 because the indices are date serial numbers, which makes them useless in case I want to save the results.
My problem is the modification of the output matrix so that I get
  • the respective entry of datevector1 in column 1 of my output matrix
  • the respective entry of datevector2 in column 2 of my output matrix
  • and the result of fmincon in column 3 of my output matrix
Thank you in advance for any helpful advice!

Answers (0)

This question is closed.

Asked:

on 24 Nov 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!