選択リスト(プルダウン)で任意の選択肢を選択状態にさせる方法
Ältere Kommentare anzeigen
matlab 2018aを使用し、matlab guiにてツールを作っています。 選択リスト(プルダウン)には選択肢が100~500まであり、初期表示時に400が 選択された状態にしたいです。 そこで以下のコードを書いたのですが 変数str_listがcell型の配列のため index = find(str_list == num2str(value)); の部分でエラーになってしまいます。 str_list = ['100', '200', '300', '400', '500'] という形式にしたいのですがどのようにすればよいでしょうか。 cell2mat(str_list)では欲しい形式にはなりませんでした。
% code
value = '400';
str_list = get(findobj(form, 'Tag', 'pulldown'), 'String');
index = find(str_list == num2str(value));
set(findobj(form, 'Tag', 'pulldown'), 'Value', index);
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu cell 配列 finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!