Select/set ItemData index of drop down in App Designer

조회 수: 12 (최근 30일)
Dominik Müller
Dominik Müller 2020년 9월 17일
댓글: Dominik Müller 2020년 9월 18일
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
Dominik Müller
Dominik Müller 2020년 9월 18일
Nevertheless thanks for your support ;)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by