필터 지우기
필터 지우기

How to use eval and disable the edit box or drop down?

조회 수: 1 (최근 30일)
raghavendra kandukuri
raghavendra kandukuri 2019년 5월 21일
댓글: raghavendra kandukuri 2019년 5월 21일
HI,
can we use eval, and disable the dropdown or edit box? for example:
the below code can visit 16 fields(editboxes) and set the value coming frim G_PB, similarly i would like to do for disableing
Thanks in Advance
for i=1:16
eval(['set(handles.PwrBlg' num2str(i) ',''String'',G_PB)']);
end

채택된 답변

Stephen23
Stephen23 2019년 5월 21일
Do NOT use eval for trivial code like this!
Much better is to read the documentation on dynamic fieldnames:
For your code, something like this:
fld = sprintf('PwrBlg%d',i);
set(handles.(fld),'String',G_PB)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by