Error using "set"

14 views (last 30 days)
Mehdi on 28 Sep 2015
Commented: Mike Garrity on 28 Sep 2015
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 Comment
Mike Garrity
Mike Garrity on 28 Sep 2015
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?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 28 Sep 2015
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.
Walter Roberson
Walter Roberson on 28 Sep 2015
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.

Sign in to comment.


Find more on Object Containers 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!

Translated by