Error using "set"

2 次查看(过去 30 天)
Mehdi
Mehdi 2015-9-28
Hi everyone.
Thank you for reading my question.
I receive the following errors when I run my code in MATLAB 2015a:
Error using set
Transform cannot be a parent.
tw1_mini = hgtransform;
set(hu1_mini, 'parent', tw1_mini)
I also get this error:
Error using set
There is no visible property on the Root class.
set(hu1_mini, 'visible', 'off');
I never had such issues when I wrote this in MATLAB 2013a.
I'd be very grateful if you could help me resolve these problems.
  1 个评论
Mike Garrity
Mike Garrity 2015-9-28
I think that something else may be going on.
In R2013a, you could set the Visible property on root to 'off' (although it didn't actually do anything). However, you should have gotten an error if you tried to set the Parent property of root. That makes me think that when your code is running in R2013a, the hu1_mini variable is getting set, but it clearly isn't in R2015a.
I'm afraid that Walter is correct, and that you're going to need to spend some time with the debugger to figure out what the difference is in how hu1_mini is getting managed. Could you show us how it got initialized, and what sorts of operations are happening on it?

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2015-9-28
For the second error, your hu1_mini is not set to a graphics object but is instead the graphics root. The pre-R2014b equivalent would be if hu1_mini had a value but the value was 0.
The first error might be from the same cause as the second error.
  2 个评论
Mehdi
Mehdi 2015-9-28
Thank you for your reply.
So how can I set hu1_mini to a graphic object?
Walter Roberson
Walter Roberson 2015-9-28
You should use the debugger to check the value of hu1_mini just after you assign it, and then also check the value just before you would set() its parent to be the hgtransform. Chances are good that they are not the same value. Why they are not the same value would depend upon your code, which you have not happened to show us.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by