I want to make an editbox in a MATLAB GUI which will only allow numbers or only allow letters to be typed into it. Is this possible?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no such feature, at least not a documented one.
You could assign a callback that will check the input, but that will happen after the user entered illegal character. Though I don’t know how exactly to do it, my guess is that you can use Java GUI.
Another interesting option is to add an ActiveX that will do the job.
Edit:
I have found an ActiveX that does the job. Downdload it, register by calling
And thein add an ActiveX in Matlab Guide. The name will be NumberBox.NbrTextBox.
You can do it by cliking the ActiveX button in Guide: