-
Notifications
You must be signed in to change notification settings - Fork 1
/
myOutputFcn.m
26 lines (25 loc) · 1011 Bytes
/
myOutputFcn.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function stop = myOutputFcn(x,optimValues,state,displayflag)
stop = false;
switch state
case 'iter'
% Make updates to plot or guis as needed
xPhys = reshape(x, nely, nelx, nelz);
%% PRINT RESULTS
fprintf(' It.:%5i Obj.:%11.4f Vol.:%7.3f ch.:%7.3f\n',optimValues.iteration,optimValues.fval, ...
mean(xPhys(:)),optimValues.stepsize);
%% PLOT DENSITIES
if displayflag, figure(10); clf; display_3D(xPhys); end
title([' It.:',sprintf('%5i',optimValues.iteration),...
' Obj. = ',sprintf('%11.4f',optimValues.fval),...
' ch.:',sprintf('%7.3f',optimValues.stepsize)]);
case 'init'
% Setup for plots or guis
if displayflag
figure(10)
end
case 'done'
% Cleanup of plots, guis, or final plot
figure(10); clf; display_3D(xPhys);
otherwise
end % switch
end % myOutputFcn