prompt a GUI user to enter different values
4 次查看(过去 30 天)
显示 更早的评论
I am using App Designer to write a GUI wrapper for an existing app. The app should load some data based on the user input. If the user input is invalid, how can I make the user try again? For example, the user entered an end time that is not after the previously entered starting time. Or as a simpler example, the user entered a string that is not one of the valid responses.
0 个评论
采纳的回答
Adam Danz
2023-4-19
Put your dialog in a while-loop that exits when the input conditions are met and regenerates the dialog if the conditions are not met.
Here is an example using input() which generates a prompt in the command window rather than generating a dialog but it would follow the same general process (dialogs are much better than input()).
4 个评论
Adam Danz
2023-4-20
Let's say you're using inputdlg. Create it within a while-loop that creates the dialog, validates the users's input, and either leaves the loop or continues for another iteration.
It will look something like this.
inputsGood = false;
while ~inputsGood
response = inputdlg(___);
inputsGood = myValidation();
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!