Matlab 指南 rotate3d 不能按预期工作

Matlab guide rotate3d doens´t work as expected

为什么 rotate3d 仅在指定图形对象句柄时有效?

% Wont work. Why?
axes(handles.fig1);
rotate3d on; 

% Works
rotate3d(handles.fig1,'on');

此外,rotate3d on; 有时会激活其他 axes/figures,但不会激活上面使用 axes(handler) 定义的。这很奇怪。

使用 GUIDE(和一般的 GUI)时,最好始终在使用将要改变特定图形对象的函数时直接指定句柄。这可以防止用户与 GUI 的交互改变预期的行为。由于用户交互和 GUIDE 经常改变图形对象的 HandleVisibility 这一事实,对 gcagcf 的依赖在 GUI 中变得非常值得怀疑。

为了激活 3D 旋转,您应该指定 axesfigure

handles.myax = axes(handles.fig1);
rotate3d(handles.myax, 'on'); 

% OR: rotate3d(handles.fig1,'on');