Creating 2 dynamic and dependent dropdown menus in App-Designer
17 次查看(过去 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 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!