Output argument (and possibly others) not assigned value in the execution with "choosedialog2" function
24 views (last 30 days)
Show older comments
The code worked for all cell number selections except the first index of 1
Not sure where to correct and run the code?
specific_index = choosedialog2(num2cell(1:20))
Accepted Answer
Walter Roberson
on 22 Nov 2023
uicontrol() style popup only triggers the callback when the selection changes
When you create a uicontrol popup, the default selection Value is 1 -- first item already selected.
What you typically end up doing is adding a header item such as 'Select Item' as the first String, so that the user has to change selection in order to select "1" .
If you do that remember that the entries are now offset by 1 -- the entry for "1" is at Value 2, the entry for "2" is at Value 3, and so on.
And remember that your processing code has to handle the possibility that later the user will chose to switch back to the header.
... And remember that this does not solve the problem of the user wanting to select the same entry twice in a row -- not unless you reset the Value to 1 (the header)
More Answers (0)
See Also
Categories
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!