Creating 2 dynamic and dependent dropdown menus in App-Designer
14 ビュー (過去 30 日間)
古いコメントを表示
Hi all.
I have two dropdowns 'ddA' and 'ddB' where ddA is a list of files from a folder and ddB is a list of variable names from the files.
I can populate both easily but don't know how to make the variables in ddB change if a different folder is selected in ddA. The files, are all txt files but can have different dimensions and different variable names. I am storing each txt file as a table, all in their own separate cell in a cell array.
Will a valueChanged call back work for this or will I have to use some form of 'if' statement?
I hope to have a plot that can update dynamically with user input. Where a change in file will update the the ddB to the variables in that file and plot col 1 vs the variable selected in ddB.
0 件のコメント
採用された回答
Voss
2023 年 7 月 21 日
Yes, a ValueChangedFcn will work for this.
The ValueChangedFcn of ddA will read the variable names from the selected file and update ddB.Items with those variable names, probably also updating ddB.Value to ensure it is valid (or just resetting it to the first Item).
The ValueChangedFcn of ddB will update the plot.
You can have the ValueChangedFcn of ddA call the ValueChangedFcn of ddB, so that when a selection is made in ddA not only does ddB update but the plot also updates automatically.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!