Adjust the view of UIAxes

3 ビュー (過去 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 Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by