A problem using the app designer
Mostra commenti meno recenti
I have a problem with the app designer . The graph instead of appearing in the app , it appears in a new window as the attached photo shows
2 Commenti
Steven Lord
il 8 Dic 2021
Please show us the code you wrote that tries to create that plot in the app.
Hassen Mohamed Yousif Abdelatif
il 8 Dic 2021
Risposta accettata
Più risposte (1)
Peter Bonavita
il 8 Dic 2021
Hi Hassen,
I understand your app generates a plot, but the plot appears in a figure outside the app. In your app's call to plot, you can specify the axis where you want the plot to appear.
Check out lines 70-71 of the .MLAPP file from this example. You can open the app using this command, then view the code shown below in the code view:
>> openExample('matlab/MortgageCalculatorExample')
Here's the code, in this case it shows the plot targets the axis at app.PrincipalInterestUIAxes
% Plot the principal and interest
plot(app.PrincipalInterestUIAxes,(1:nper)',principal, ...
(1:nper)',interest);
legend(app.PrincipalInterestUIAxes,{'Principal','Interest'},'Location','Best')
xlim(app.PrincipalInterestUIAxes,[0 nper]);
I wasn't able to reproduce using your app but it looks like you'll just need to add app.UIAxes in your calls to plot, something like:
plot(app.UIAxes, app.voltage, app.displacement)
Hope this helps,
Peter
Categorie
Scopri di più su Develop Apps Using App Designer in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!