- You can write a callback function that generates a figure or uifigure when interactiving with one of the UI components (or have it appear using a startup function). Using the figure handle, you can change the position of the figure/uifigure as you have probably done so in your live script. One way to do this is to convert the figure units to normalize and then you can change the position of the figure accordingly, where a value greater than 1 would likely place the figure on the other monitor depending on your layout. You could also detect the screen resolution and set pixel coordinates this way. You could also change the WindowState to fullscreen or maximized. If you need any help with this approach let me know.
- You can use a multiwindow app approach (see link for more detailed instructions). Here, you create multiple apps that can communicate with one another using property variables, input arguments, and startup functions. When you create an app, you have the ability to make it maximized or fullscreen within the component browser when you select the UIFigure (see image below). You could use simliar approaches mentioned in #1 by programmatically adjusting the position or windowstate in a startup function for the app. Once again, if you need any more help with this let me know.
Projecting a plot onto a second monitor through an App made in the App Designer.
30 views (last 30 days)
Show older comments
I am creating an app that dynamically changes plots based on inputs (which I have done) and projects the plot fullscreen onto a second monitor which also dynamically changes with the inputs.
I have made a livescript that is capable of projecting a plot fullscreen to a second monitor that dynamically changes, but I'm unsure how to accomplish this through App Designer. Is there is a way to have an App create a figure outside the app itself? From there I would be able to manipulate it to fill a second screen.
Thanks in advance
0 Comments
Accepted Answer
Kevin Holly
on 27 Feb 2022
Edited: Kevin Holly
on 27 Feb 2022
Yes. There are multiple ways of doing this with App Designer. Below are two approaches.
More info: https://www.mathworks.com/help/matlab/creating_guis/creating-multiwindow-apps-in-app-designer.html
2 Comments
Kevin Holly
on 28 Feb 2022
Al,
I attached an example app. You will need to make sure your axes handle is defined as a property variable (please see code in the app attached).
Alternatively, you could define your figure handle as a property variable.
properties (Access = private)
figurehandle
end
function startupFcn(app)
figurehandle = uifigure;
figurehandle.Units = "normalized";
figurehandle.Position = [1 0 2 1];
figurehandle.WindowState = "fullscreen";
uiaxes(secondwindow);
end
Then when your UI component is activated, the callback function could be
function ButtonPushed(app, event)
plot(app.figurehandle.Children,x,y) % Assuming there is only one child for the figure and it is an axes
end
More Answers (0)
See Also
Categories
Find more on Develop Apps Using App Designer in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!