Adjust the view of UIAxes

조회 수: 6 (최근 30일)
Pelajar UM
Pelajar UM 2022년 5월 30일
댓글: Walter Roberson 2022년 5월 31일
I plot a stl file by pressing a button. Then I rotate it around and change the view. And when I click on the button again, the view goes back to the default position.
I don't want it to go back to the deafult. I want it to use the latest view. But this doesn't work and still goes back to the default:
function ButtonPushed(app, event)
X = get(app.UIAxes,"View");
set ( app.UIAxes,"View", X);
data = stlread ("model.stl");
trisurf (data,'Parent', app.UIAxes);
end

채택된 답변

Walter Roberson
Walter Roberson 2022년 5월 30일
Try
function ButtonPushed(app, event)
X = app.UIAxes.View;
data = stlread ("model.stl");
trisurf (data,'Parent', app.UIAxes);
drawnow;
app.UIAxes.View = X;
end
  댓글 수: 8
Pelajar UM
Pelajar UM 2022년 5월 31일
For anyone else wondering, this works:
ax=app.UIAxes;
ax.Interactions = [rotateInteraction zoomInteraction];
Walter Roberson
Walter Roberson 2022년 5월 31일
Oh, that looks useful!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by