Error in function "rotate" in version 2015a

Hi everyone,
I wrote a code in version 2013a which uses rotate function but when I run the code in MATLAB 2015a I get the following error:
Error using matlab.graphics.GraphicsPlaceholder/get
Property type not found in class matlab.graphics.GraphicsPlaceholder, or is not present in all elements of the array of class matlab.graphics.GraphicsPlaceholder.
Error in rotate (line 59)
t = get(h(i),'type');
Error in c_the_prev (line 70)
rotate(hu1, [0 1 0], 90, [0 0 0])
Error in custom_color>design_Callback (line 220)
c_the_prev
Error in custom_color_custom_color_OpeningFcn (line 84)
design_Callback(hObject, eventdata, handles);
Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
Error in custom_color (line 42)
gui_mainfcn(gui_State, varargin{:});
What causes the error? I checked the Help documentation for rotate but couldn't find anything different from 2013a. Any insight would be appreciated.

 采纳的回答

Whatever object hu1 that you are attempting to rotate has not been initialized. The variable exists but has not been assigned an actual graphics object.

4 个评论

Walter -
The hu1 is a 3D object created by surface function:
hu1(1) = surface(xc1, yc1, 0.01*zc1,'FaceColor', 'y','EdgeColor','none');
hu1(2) = surface(xc2, yc2, 0.03*zc2,'FaceColor', 'b','EdgeColor','none');
hu1(3) = surface(xc3, yc3, 0.05*zc3,'FaceColor', 'r','EdgeColor','none');
I need to rotate it 90 deg using rotate:
rotate(hu1, [0 1 0], 90, [0 0 0])
The page you sent me does not offer a concrete solution and I was even more confused because I'm not a professional coder. I just need a code to transition from double to handle or whatever the process is. Could you please be more specific on the solution? How would you resolve this problem? Thank you very much.
Is hu1 created in the same routine as the rotate() is called? If you get(hu1(1),'type') right after you initialize it, what is returned? If you do the same thing right before you rotate it, what is returned?
Walter -
You were right about the difference of routines where hu1 is defined and where it's attempted to be rotated. I defined hu1 as global variable and now the problem is solved! This was not necessary in older versions. Thank you for the input.
get(hu1(1),'type') returns "root".
If it's not too much trouble, do you think you can take a look at my other question which is basically about an error that I get for "load topo" in 2015a? I'd be very grateful.
Thanks anew.
get(hu1(1),'type') of root definitely corresponds to undefined. If you were to check in previous releases you would likely find that your hu1(1) value was 0.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Graphics 的更多信息

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by