MATLAB Guide - Simulating a 4 digit keypad?

9 views (last 30 days)
Hello,
I'm looking to simulate a 4 digit keypad. So when a password of the correct 4 numbers are entered, something is displayed.
I've made a GUI using GUIDE that contains 4 buttons labelled 1 through 4. Now, I want to prompt the user to enter a password. Say the password is 1234, how can I implement this?
I assume it'll involve nested loops, to check if each button is pressed in the correct sequence, however, I am unsure of how to do this.
Any ideas or suggestions will be greatly appreciated.
Thanks for your time.

Accepted Answer

Chandrasekhar
Chandrasekhar on 26 Mar 2014
find the attached gui. you can use this for your requirement. hope this works
  1 Comment
thebasher
thebasher on 26 Mar 2014
I cannot stress my appreciation for this. Thanks for taking the time out of your day to help me. I had already made a username/password interface in the matlab window, that was capable of comparing strings, however, I could not figure out how to implement it in guide.
Assuming the password is 1234, there could be a small error.
The only thing that might be incorrect is that when the number 4 at any of the first three positions (i.e. 4xx, 14xx, 114x), the code will take the input as error regardless of the remaining numbers. However, if the user enters 3333 (also incorrect), the code still allows for all four numbers to be input before determining it is incorrect. Hope this made sense. I'll be able to fix that though.
Regardless, you got me on the right track, and I look forward to tweaking it . Thanks so much for your help! I'm not very knowledgeable with GUIDE, but I've already learned so much.
Cheers

Sign in to comment.

More Answers (0)

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!