How can I plot a plotsomhits inside an app using app designer?

2 visualizaciones (últimos 30 días)
Paul Buckland
Paul Buckland el 12 de Ag. de 2019
Respondida: Kanishk el 19 de Dic. de 2024
I am designing an app with the app designer, which runs a clustering neural net. I'd like to plot plotsomhits inside the app in an axes, but running plotsomhits always opens a new figure instead.
How can I make this chart inline in the app?

Respuestas (1)

Kanishk
Kanishk el 19 de Dic. de 2024
The MATLAB function 'plotsomhits' plots the data after creating a new figure. There is currently no arguement to specify custom figure or axes. To get around this you can copy the axes created in the new figure to the axes in the app using 'copyobj'.
Here is the code for Button pushed callback in a simple MATLAB Application using app designer demonstrating the same.
function ButtonPushed(app, event)
x = iris_dataset;
net = selforgmap([5 5]);
net = train(net,x);
f = plotsomhits(net,x);
f.Visible = 'off';
ax1 = f.CurrentAxes;
copyobj(ax1.Children,app.UIAxes);
close(f);
end
After the button is pressed, the plot appears in the app itself.
You can learn more about 'copyobj' from the following command.
web(fullfile(docroot, 'matlab/ref/copyobj.html'))
Happy Coding!

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by