MATLAB Guide - Simulating a 4 digit keypad?

조회 수: 2 (최근 30일)
thebasher
thebasher 2014년 3월 26일
댓글: thebasher 2014년 3월 26일
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