フィルターのクリア

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

2 ビュー (過去 30 日間)
Xymbu
Xymbu 2022 年 10 月 30 日
コメント済み: Xymbu 2022 年 11 月 2 日
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 Center および File ExchangeModel 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