フィルターのクリア

editing gui text box string

2 ビュー (過去 30 日間)
Milad Javan
Milad Javan 2011 年 7 月 21 日
I have a GUI project with 32 text box. Textbox tags are like this: X01, X02,...,X32. I want want to write a program that when i press a pushbutton it execute a for loop like (for i=1:32) and change the String Propery of each Textbox. same as below
for i=1:32
set(handles.ithTextbox,'String',num2str(data(i)));
end
How can I select ith Textbox?

採用された回答

Daniel Shub
Daniel Shub 2011 年 7 月 21 日
Something like:
for ii = 1:32
h_text = findobj(h_gui, 'Tag', ['X', num2str(ii)]);
set(h_text, 'String', num2str(data(ii));
end
would work if your textbox tags where X1, X2, ... , X32. You need to adapt it a little to deal with X01, X02, ... , X32.
  1 件のコメント
Milad Javan
Milad Javan 2011 年 7 月 21 日
Thanks again.

サインインしてコメントする。

その他の回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2011 年 7 月 21 日
Would this work?
for i=1:32
Tag=sprintf('X%02d',i);
set(handles.(Tag),'String',num2str(data(i)));
end
I verified. Using dynamic field name works!
  1 件のコメント
Milad Javan
Milad Javan 2011 年 7 月 21 日
Tnx

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by