Create dropdown at runtime of guide
조회 수: 6 (최근 30일)
이전 댓글 표시
Hello,
I'm currently creating a GUI (matlab 2017 with guide) and I would like the user to be able to press a button which will add a dropdown menu where he then can select data from. The user shall be able to add as many of these dropdowns as he wants.
My current ide is, create a button with a callback which has runns the following code:
function AddFilterStage1_Callback(hObject, eventdata, handles)
ElementNumber=GetNewDropdownNumber(handles);
handle.(['dropdown',num2str(ElementNumber)])=uidropdown
end
unfortunately this creates the dropdown in a new figure, not in the GUI I'm already running. I read the documentation of uidropdown and it says, that I can do uidropdown(fig) where fig = uifigure('Position', [100 100 300 250]), so naturally I tried uidropdown(handles) which didn't work out as well.
I also tried:
handle.(['dropdown',num2str(ElementNumber)])=handle.(['dropdown',num2str(ElementNumber-1)])
But this would not create a copy of the button instead the Element n and Element n-1 are connected to the same dropdown (so I can manipulate the same dropdown with both Elements in the Class).
Is there a different way to achieve what I want to do or what am I doing wrong?
Thank you in Advance,
Markus
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!