How to use the RF PCB Toolbox's show function inside of a Matlab App?

6 views (last 30 days)
I'm working with the RF PCB Toolbox and am creating a simple Matlab App like shown below:
The goal is when pressing the plot button it will change the figure and display the result generated by the "show()" function.
The show function by itself has an output that looks like this:
However, when I call the show function inside the callback for the Plot button it hijacks the entire UI window and deletes the buttons/knobs. I just want the show function plot to occupy the space where the empty plot in the app UI window occupies.
One of Matlab's App tutorial video shows an example using "scatter(app.UIAxes,x,y)" but there is no way I can find to do that with the show function.
I've also tried using "focus(app.UIAxes)" but it gives the error message "Undefined function 'focus' for input arguments of type 'matlab.ui.control.UIAxes'."
  1 Comment
Michael Ferguson
Michael Ferguson on 7 Nov 2023
Happy to add any additional info if it might make the question easier to answer. I'm just confused if the show function has some sort of special implementation that doesn't allow it to be plotted to an axes (as opposed to a complete figure?)
Maybe it is possible to plot nested figures inside of a Matlab app?

Sign in to comment.

Answers (1)

Gowtham
Gowtham on 17 Nov 2023
Hello Michael,
I understand you are trying to get the output of 'show()' from the RF PCB toolbox without affecting any buttons / knobs of the app.
It appears that directly capturing the output of 'show()' is not possible due to the default presence of axes, making it impractical to display it in an empty plot.
To overcome this issue, one potential solution is to create a 'figure' window before invoking the 'show()' function.
For a sample demonstration of the above process, kindly refer to the following code snippet:
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
figure;
inductor = spiralInductor;
show(inductor);
end
Below is the output of the executed code snippet:
Kindly refer to the following MATLAB Documentation for further information on how to use ‘show()’ and ‘figure’:
Hope it helps.
Best Regards,
Gowtham

Categories

Find more on Get Started with RF PCB Toolbox in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!