Select/set ItemData index of drop down in App Designer

24 views (last 30 days)
Hi folks,
I created an app in app designer which has an Edit Field where a user can enter an IP and a drop down menu where you can choose the last five entered IPs. By pressing a button 'OK' the value entered in the Edit Field is compared with a document in which i store the last five entered IPs if it already exists, the index get's changed an it is set to the first position of the document to keep it chronological. The value is also passed to the next GUI where some actions happen. I have also a button from the second GUI to get back to the first GUI (in case you want to change the IP).
My problem right now is that when I choose an IP out of the list let's say IP #3 the index is also set to 3. If I try to enter a new IP by pressing the button in GUI 2 I get an 'out of index' error while GUI 1 goes through my saved list but not starting with index 1 but with index 3. Is there a way to set the index on the first Item and not the last I choose?
app.previouslyusedPortsDropDown.ItemsData = [1,2,3,4,5];
for i=1:1:5
app.previouslyusedPortsDropDown.Items(i) = cellstr(ports(i));
By leaving GUI 1 and entering GUI 2 I tried to clear all and delete GUI 1 to ensure everything get's loaded correctly as if I start the program out of nowhere.

Sign in to comment.

Answers (0)


Find more on Migrate GUIDE Apps in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!