Adjust the view of UIAxes

5 Ansichten (letzte 30 Tage)
Pelajar UM
Pelajar UM am 30 Mai 2022
Kommentiert: Walter Roberson am 31 Mai 2022
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 30 Mai 2022
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 Kommentare
Pelajar UM
Pelajar UM am 31 Mai 2022
For anyone else wondering, this works:
ax=app.UIAxes;
ax.Interactions = [rotateInteraction zoomInteraction];
Walter Roberson
Walter Roberson am 31 Mai 2022
Oh, that looks useful!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by