フィルターのクリア

Pass text from an edit text to a lisbox

1 回表示 (過去 30 日間)
Nuno Fernandes
Nuno Fernandes 2011 年 7 月 11 日
Hello everyone,
I have a edit text to write (with a random lenght) :
C7-H9 ; HH-PP; ( like this example, every word is separated from the next one by a '';'')
and i want to pass this to a listbox (after write everything i want in the edit text). I have a 'Go' button to pass this. My doubt it's how can i pass from
C7-H9 ; HH-PP
to a list box and see all the information in the listbox like this:
C7-HH HH-PP (in different lines, like a matrix (2,5)
Any ideas???? Thanks for help.

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 7 月 11 日
You will need to read the Edit text string and process it and then write it to the Listbox.
figure(1)
h1=uicontrol('style','edit','string','ab;cd;ef;gh');
figure(2)
h2=uicontrol('style','listbox');
Text=get(h1,'String');
Text=regexp(Text,';','split');
set(h2,'String',Text);
  1 件のコメント
Nuno Fernandes
Nuno Fernandes 2011 年 7 月 11 日
Problem solve! Thank you.

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

その他の回答 (2 件)

Nuno Fernandes
Nuno Fernandes 2011 年 7 月 11 日
Just one more question,
I want to get the information of the listbox ( command get ( this i know)) but then i want to compare each part of the string. Example:
I have in a listbox B7-F9 and B8-H9 and i want to compare the start and de final of each string with 'C3'.How can i do that? Thank you.

Fangjun Jiang
Fangjun Jiang 2011 年 7 月 11 日
a={'B7-F9','B8-H9'};
b=regexp(a,'-','split');
strcmp(b{1},'C3')
strcmp(b{2},'C3')

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by