MATLAB Guide - Simulating a 4 digit keypad?

3 次查看(过去 30 天)
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.

采纳的回答

Chandrasekhar
Chandrasekhar 2014-3-26
find the attached gui. you can use this for your requirement. hope this works
  1 个评论
thebasher
thebasher 2014-3-26
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by