Children option with matlab 2013

조회 수: 1 (최근 30일)
Pablo Morcillo Pallarés
Pablo Morcillo Pallarés 2018년 5월 9일
댓글: Pablo Morcillo Pallarés 2018년 5월 9일
Hi
So I am trying to 'disable' an option for my gui in matlab. I am working with different versions of matlab.
In matlab 2016, I can directly set this command:
set(handles.untitle.children(1),'enable','off')
And the option in that part will go disable. But if i try to do the same in older versions of matlab, like 2013, it doesnt allow me because it is trying to access a number.
If I try to do something like:
get(handles.untitle,'Children')
It will get me a list of number, instead of the list of variables i can see in matlab 2016.
So, how can i modify the variable in older versions of matlab?
thanks in advance!

채택된 답변

Jan
Jan 2018년 5월 9일
편집: Jan 2018년 5월 9일
The numbers you see in e.g. R2013 are the wanted graphic handles. Before R2014a, which introduced the new graphics library called "HG2", doubles have been used for graphic handles. In consequence your code is correct already:
Children = get(handles.untitle, 'Children');
set(Children(1), 'enable', 'off');
By the way, it is not save to assume, that a specific object is the first children. Recognizing an object by its 'Tag' and/or 'Type' is safer. Even more efficient is to store the handle of the object during the creation already instead of searching it dynamically.
  댓글 수: 1
Pablo Morcillo Pallarés
Pablo Morcillo Pallarés 2018년 5월 9일
Thanks you!!! that way now works fine in both version. Good to know that it was added on 2014.
I will give a look at Tag, but for the moments works fine!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by