ドロップダウンボックスの選択肢について

表題の件についてご教示いただきたいです。
App Designerでアプリを作成しているのですが、ドロップダウンボックスの選択肢を選択する際( function DropDownOpening(app, event)以降)添付CSVのようなCSVを読み込み、2行目の値が1であれば1行目の内容がドロップダウンボックスの選択肢として表示され、0であれば空白または非表示となるようなプログラミングを作成したいのですが、アドバイスいただけないでしょうか?
調べてもあまりドロップダウンボックスの選択肢を条件によって変化させる方法がないため。
宜しくお願いします。

 Accepted Answer

Hernia Baby
Hernia Baby on 4 Mar 2023

1 vote

簡単なデモファイルを作成しました(添付)。
ボタンを押すと以下のようなプログラムが動きます。
[filename,path] = uigetfile("*.csv","データを選択");
A = readtable(fullfile(path,filename));
idx = A.Value == 1;
app.DropDown.Items = table2cell(A(idx,1));

1 Comment

A.T
A.T on 7 Mar 2023
ありがとうございます!解決しました!

Sign in to comment.

More Answers (0)

Categories

Find more on App Designer を使用したアプリ開発 in Help Center and File Exchange

Asked:

A.T
on 3 Mar 2023

Commented:

A.T
on 7 Mar 2023

Community Treasure Hunt

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

Start Hunting!