running x.m file many times. I want to store values separately.

4 visualizaciones (últimos 30 días)
N/A
N/A el 23 de Oct. de 2018
Comentada: N/A el 24 de Oct. de 2018
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
N/A
N/A el 23 de Oct. de 2018
Editada: N/A el 23 de Oct. de 2018
Thank you. Actually I am taking max(profits) and I want to store this value so that on next iteration I can compare both max values and want to store maximum among them. So basically for one iteration it is 1x1 array and finally as a result I want maximum max value among all iterations but also want to store max of each iteration. I am facing problem in comparison as in mat file i am having only max value of last iteration which is not sufficient. Thank you again.
N/A
N/A el 23 de Oct. de 2018
this image is for iteration=2;but it is storing only max value of iteration=2. instead of that i want to store and compare both max values. so i want this for each iteration.

Iniciar sesión para comentar.

Respuesta aceptada

dpb
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
dpb
dpb el 24 de Oct. de 2018
Glad to hear it...I knew you could do it! :)
N/A
N/A el 24 de Oct. de 2018
without your help it won't be possible. really thank you. :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2014a

Community Treasure Hunt

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

Start Hunting!

Translated by