MATLAB Guide - Simulating a 4 digit keypad?

2 visualizaciones (últimos 30 días)
thebasher
thebasher el 26 de Mzo. de 2014
Comentada: thebasher el 26 de Mzo. de 2014
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.

Respuesta aceptada

Chandrasekhar
Chandrasekhar el 26 de Mzo. de 2014
find the attached gui. you can use this for your requirement. hope this works
  1 comentario
thebasher
thebasher el 26 de Mzo. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by