필터 지우기
필터 지우기

how to extract and use the uicontrol from an cell array

조회 수: 3 (최근 30일)
Dongyan Zhu
Dongyan Zhu 2020년 4월 28일
댓글: Dongyan Zhu 2020년 4월 28일
I created 6 static texts with names: Reihenfolge1RealTime, Reihenfolge2RealTime,...
and now I want to make some of them invisible using:
set(handles.Reihenfolge3RealTime,'Visible','off');
set(handles.Reihenfolge4RealTime,'Visible','off');
set(handles.Reihenfolge5RealTime,'Visible','off');
set(handles.Reihenfolge6RealTime,'Visible','off');
In order to simplify and make these codes readable, I came up with an idea by using an cell array to store the above 6 uicontrols:
handles.ReihenfolgeRealTime = {handles.Reihenfolge1RealTime,handles.Reihenfolge2RealTime,...};
and also tried to use a ''for'' loop:
for i=3:1:size(handles.ReihenfolgeRealTime,2)
set(handles.ReihenfolgeRealTime(i),'Visible','off');
end
But by debugging the Matlab said :
Error using set
Conversion to double from cell is not possible.
Does anyone know how to solve this problem?

채택된 답변

Tommy
Tommy 2020년 4월 28일
Indexing into a cell array with ( ) gives you another cell array. Use { } instead to access the data inside that cell array:
for i=3:1:size(handles.ReihenfolgeRealTime,2)
set(handles.ReihenfolgeRealTime{i},'Visible','off');
end

추가 답변 (0개)

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by