Adjust the view of UIAxes
    4 views (last 30 days)
  
       Show older comments
    
    Pelajar UM
 on 30 May 2022
  
    
    
    
    
    Commented: Walter Roberson
      
      
 on 31 May 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 
0 Comments
Accepted Answer
  Walter Roberson
      
      
 on 30 May 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 Comments
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!
