Filter löschen
Filter löschen

Creating 2 dynamic and dependent dropdown menus in App-Designer

27 Ansichten (letzte 30 Tage)
Cathal
Cathal am 21 Jul. 2023
Beantwortet: Voss am 21 Jul. 2023
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.

Akzeptierte Antwort

Voss
Voss am 21 Jul. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by