0
私は2つのリストボックスを持っています:Matlab:選択した項目をリストボックスに追加するには?
'unselectedchannellistbox'はすべてのアイテムを(nx1)セルとして含んでいます。 'selectedchannellistbox'は空です。
'selectchannels'はプッシュボタンです。
「unselectedchannellistbox」から「selectectedchannellistbox」にアイテムを追加します。しかし、私は削除したり、項目を上書きしたくない!
この
は私のコードです:(エンド+ 1)とgetと私の新しいセル配列(S)への別の要素を追加し、function selectchannels_Callback(hObject, eventdata, handles)
% Get selected item
listbox_strings = get(handles.unselectedchannellistbox,'String');
selected_value = get(handles.unselectedchannellistbox,'Value');
S = num2cell(selected_value);
for k = 1:length(S)
S(end+1) = {get(handles.unselectedchannellistbox,'Value')};
end
set(handles.selectedchannellistbox,'String',selected_value)
残念ながら(handles.unselectedchannellistbox、 '値')は動作しません。 。
どうなりますか?
ありがとうございました!
ミシェ
_指定してください。エラーメッセージ?間違った結果? ... – m7913d
これは間違った結果でした... Listbox2の項目は上書きされているので、常に1つの項目しかありませんでした。 –