필터 지우기
필터 지우기

Pop-out axes from appdesigner into a separate figure

조회 수: 27 (최근 30일)
Quy
Quy 2024년 7월 19일 17:45
편집: Quy 2024년 7월 19일 18:49
I have an app from appdesigner. There is an axes in this app, and I would like to pop-out this axes into a separate figure. Is there a way to do this?
Note: I see that it is possible to "Open in figure window" when using the Live Editor. Can the same functionality be replicated with axes in the appdesigner?

채택된 답변

Ruchika Parag
Ruchika Parag 2024년 7월 19일 18:21
Hi Quy, to pop out axes from an App Designer app into a separate figure window, you have to create a new figure and copying the content of the axes from the app to this new figure. Here is a step-by-step guide to achieve this:
  1. Create a Button in Your App: Add a button in your App Designer app to trigger the pop-out action.
  2. Button Callback Function: Implement the callback function for the button to create a new figure and copy the axes content.
Here is how you can implement the functionality:
  1. Add a Button: Add a button in your app.
  2. Button Callback: Implement the callback for the button.
% Button pushed function: PopOutButton
function PopOutButtonPushed(app, event)
% Create a new figure
newFig = figure;
% Create new axes in the new figure
newAxes = axes(newFig);
% Copy the content of the original axes to the new axes
copyobj(allchild(app.UIAxes), newAxes);
% Set the limits and labels of the new axes to match the original
newAxes.XLim = app.UIAxes.XLim;
newAxes.YLim = app.UIAxes.YLim;
newAxes.ZLim = app.UIAxes.ZLim;
newAxes.XLabel.String = app.UIAxes.XLabel.String;
newAxes.YLabel.String = app.UIAxes.YLabel.String;
newAxes.ZLabel.String = app.UIAxes.ZLabel.String;
newAxes.Title.String = app.UIAxes.Title.String;
end
By following these steps, you can effectively pop out an axes from an App Designer app into a separate figure window. I hope this is helpful!
  댓글 수: 3
Quy
Quy 2024년 7월 19일 18:47
편집: Quy 2024년 7월 19일 18:48
@Walter Roberson, I will have to keep this in mind for later use.
Quy
Quy 2024년 7월 19일 18:48
편집: Quy 2024년 7월 19일 18:49
@Ruchika Parag, thanks. I thought about doing that as well, but was looking for a more built-in/cleaner method.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by