How can I create a plot during an Optimization using Output Function?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
HerrVader
am 22 Jul. 2015
Beantwortet: Mike Garrity
am 22 Jul. 2015
I tried plot some Points of my Optimization (I used gamultiobj) using an Output Function. But all Figures appear only when the optimization has finished or I quit the Programm using "ctrl +c".
I use the following OutputFcn:
function [st, opt,optchange] = gamOutput( optionsin,statein,flag)
disp(statein.Score)
disp(statein.Population)
figure
plot(statein.Score(:,1),statein.Population(:,1))
st = statein;
opt = [];
optchange = 0;
end
I know that the function is called because the score and the population are diplayed in the command Window during the Optimization. I just don't know, why the figures are all created at the end of the Optimization.
0 Kommentare
Akzeptierte Antwort
Mike Garrity
am 22 Jul. 2015
My guess is that you need a drawnow at the end to tell the graphics system that it can go ahead and push the graphics out to the screen.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!