When using listdlg, what is the value assigned when the user exits without making a selection?
Show older comments
I'm using listdlg to give the user a dropdown list to make a selection of. While debugging, I tried exiting the listdlg without making a selection, and I got an error.
I tried to validate the data underneath by using a while loop. Normally when a user exits a menu without making a selection, the variable is assigned to 0. My error is occurring almost 90 lines later, so as long as the data is validated, there shouldn't be any errors.
choice = listdlg("PromptString",{"Select a plant to learn more about."},"SelectionMode","single","ListString",CP);
while choice == 0 % forces user to make selection
choice = listdlg("PromptString",{"Select a plant to learn more about."},"SelectionMode","single","ListString",CP);
end
Since my while loop is just bypassed if the user exits without making a selection, that means the variable choice is not 0. If it's not assigned to 0 when the user exits without making a selection, what is the value assigned?
Accepted Answer
More Answers (0)
Categories
Find more on App Building 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!