필터 지우기
필터 지우기

Hide multiple 'edit text'

조회 수: 1 (최근 30일)
SmaShBr0ther
SmaShBr0ther 2018년 1월 31일
편집: Gayatri Menon 2018년 3월 30일
Hi everybody. I have several edit texts where I'm trying to read the SoC and SoH values of cells in a GUI. I now want to hide all edit texts that will not be used (determined by a number from a dropdown menu). The edit text tags use a continuous numeration (SoH_C1_1, SoH_C2_1, SoH_C3_1 and so on) I now tried using a for loop to hide all the unwanted edit texts
for i = 2:x
name = strcat('SoH_C',num2str(i),'_1')
set(handles.name,'Visible','Off')
end
Is it somehow possible to use the variable 'name' as shown above?
Thanks in advance

채택된 답변

Gayatri Menon
Gayatri Menon 2018년 2월 12일
편집: Gayatri Menon 2018년 3월 30일
Hi,
set(H,Name,Value) specifies a value for the property Name on the object identified by H.
The string(name) you are creating is of type char. You cannot use this value directly in set command instead, you can use this value to find the objects with the same Tag name and set their visibility to 'Off'
for i = 2:x
name = strcat('SoH_C',num2str(i),'_1')
a=findobj('Tag',name)
set(a, 'Visible','Off')
end
Hope the above helps
Thanks
  댓글 수: 1
SmaShBr0ther
SmaShBr0ther 2018년 3월 1일
Thanks, this worked well also for other things where i wanted to edit multiple handles. one comment: the command is findobj not find_obj

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

추가 답변 (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