running x.m file many times. I want to store values separately.
1 view (last 30 days)
Show older comments
I am running x.m file 25 times repeatedly in one go. I want to store separately max and min values(operations in x.m file) of each iteration in matrix form in mat file. Can anyone suggest?
6 Comments
Accepted Answer
dpb
on 23 Oct 2018
N=25; % or whatever max number is
n=5; % or whatever number observations/iteration is
p=zeros(N,n); % holding array for the results of N iterations w/ n results/iteration
for i=1:N
for j=1:n
p(i,j)=x(....); % each call to the function returns one profit value???
end
end
[mxpgen,ixgen]=max(p,[],2); % max of each generation by iteration and which generation
[mxptot,ixtot]=max(mxpgen); % max overall and which iteration contained it
If you modify x to operate in vector sense, it could return the first result itself.
5 Comments
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!