Azzera filtri
Azzera filtri

how to extract and use the uicontrol from an cell array

3 visualizzazioni (ultimi 30 giorni)
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?

Risposta accettata

Tommy
Tommy il 28 Apr 2020
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

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by