Borrar filtros
Borrar filtros

Select/set ItemData index of drop down in App Designer

13 visualizaciones (últimos 30 días)
Dominik Müller
Dominik Müller el 17 de Sept. de 2020
Comentada: Dominik Müller el 18 de Sept. de 2020
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];
load('ports.mat','ports')
for i=1:1:5
app.previouslyusedPortsDropDown.Items(i) = cellstr(ports(i));
end
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.
  6 comentarios
Dominik Müller
Dominik Müller el 18 de Sept. de 2020
Nevertheless thanks for your support ;)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by