Creating 2 dynamic and dependent dropdown menus in App-Designer
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Voss
le 21 Juil 2023
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 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!