필터 지우기
필터 지우기

How to specify a parent UIplot for the plots that the bayesopt() funtion provides

조회 수: 2 (최근 30일)
I am using app designer. and I don't want the product plots when using the bayesopt() function with neural network training to just pop up in new figures but I'm have a hard time trying to find how I can specify a parent UI for them. my function looks like
BayesObject = bayesopt(opt.ObjFcn,opt.optimVars, ...
'MaxTime',opt.MaxOptimizationTime, ...
'IsObjectiveDeterministic',false, ...
'MaxObjectiveEvaluations',opt.MaxItrationNumber,...
'PlotFcn', {@plotObjective,@plotObjectiveEvaluationTime,@plotMinObjective,@plotElapsedTime},...
'Verbose',isLog,...
'UseParallel',false);

채택된 답변

Kevin Holly
Kevin Holly 2022년 10월 31일
편집: Kevin Holly 2022년 10월 31일
I can think of a way of placing data into the app's UI once the bayeopt function has run. You could then immediately close of the pop up figure windows.
You could create panels and transfer axes to it (see app attached).
h = gca;
h.Parent = app.Panel;
close(gcf)
h = gca;
h.Parent = app.Panel_2;
close(gcf)
Or if you transfer the children of the pop up axes to the UIAxes in your app with something like this:
h = gca;
app.UIAxes2.XLabel = h.XLabel;
app.UIAxes2.YLabel = h.YLabel;
app.UIAxes2.Title = h.Title;
app.UIAxes2.XLim = h.XLim;
app.UIAxes2.YLim = h.YLim;
for ii = length(h.Children):-1:1
h.Children(ii).Parent = app.UIAxes2;
end
close(gcf)
h = gca;
app.UIAxes2.XLabel = h.XLabel;
app.UIAxes2.YLabel = h.YLabel;
app.UIAxes2.Title = h.Title;
app.UIAxes2.XLim = h.XLim;
app.UIAxes2.YLim = h.YLim;
for ii = length(h.Children):-1:1
h.Children(ii).Parent = app.UIAxes2;
end
view(app.UIAxes2,15,15)
close(gcf)
If you want each iteration to display like an animation on the uiaxes in the app, you could open the BayesianOptimization function and change the axes. Looks like the Axes is define between lines 616 and 635. Note, you may want to save a modified copy of the BayesianOptimization function and call it in a modified bayesopt function. Perhaps you could add an input to the function called app. Then have it plot on the uiaxes you desire (e.g. app.UIAxes).
open BayesianOptimization

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Model Building and Assessment에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by