フィルターのクリア

Use of list box Matlab GUI

2 ビュー (過去 30 日間)
Tania
Tania 2015 年 9 月 15 日
編集済み: Tania 2015 年 9 月 16 日
Hi there,
I want to know how can I link two list box and then pass the values of both list boxes in a text box using a push button.
Any suggestion will be appreciated.

採用された回答

Walter Roberson
Walter Roberson 2015 年 9 月 15 日
In the callback for the push button:
str1 = cellstr(get(handles.listbox1, 'string'));
val1 = get(handles.listbox1, 'value');
if isempty(val1)
selection1 = '';
else
selection1 = str1{val1};
end
str2 = cellstr(get(handles.listbox2, 'string'));
val2 = get(handles.listbox2, 'value');
if isempty(val2)
selection2 = '';
else
selection2 = str2{val2};
end
combined_selection = {selection1; selection2};
set(handles.textbox, 'string', combined_selection);
  1 件のコメント
Tania
Tania 2015 年 9 月 16 日
編集済み: Tania 2015 年 9 月 16 日
Thank you very much. It works when I select values from each listbox and then press push button.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by