running x.m file many times. I want to store values separately.
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
dpb
el 23 de Oct. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
