asking for a password or code.

143 vues (au cours des 30 derniers jours)
Ejay Kasai
Ejay Kasai le 13 Sep 2011
Modifié(e) : Serge le 8 Avr 2023
hey guys, what's the code that matlab program will ask for a password?if password is incorrect, the program will terminate. if it's correct the program will continue.
  5 commentaires
Pedro Rodriguez Alicea
Pedro Rodriguez Alicea le 19 Mai 2020
why cant i use this type of code for a gui?
i want to as soon as i run my gui get a pop up that requests a password
thank you!

Connectez-vous pour commenter.

Réponse acceptée

Jan le 14 Sep 2011
There are some submissions in the FEX for a password input dialog:
But the abortion of the program must be implemented by the user. If you distribute your program as M- or P-files, the protection level will be limited, see FEX: passprotect. Breaking this protection will take several minutes only. But at least the user needs a criminal intent to do this.
  1 commentaire
Serge le 7 Avr 2023
Modifié(e) : Serge le 8 Avr 2023
I wasn't hapy with eithe of those, so I made my own:

Connectez-vous pour commenter.

Plus de réponses (4)

Fangjun Jiang
Fangjun Jiang le 13 Sep 2011
MATLAB doesn't have that function. You can use input() to ask the user to type in some numbers or letters. You have to do encryption yourself if you want to implement some type of password checking procedure.
The simplest way to do might be this. Ask the user to type in a password, compare it with a pre-defined one. The pre-defined one is stored in your source code (.m file). But you can use pcode() to convert your .m file to .p file. Since .p file is encrypted, you have some type of encryption protection. But it's not easy to implement a password changing functionality.
  2 commentaires
Walter Roberson
Walter Roberson le 16 Sep 2011
You could use one-way hashing, like Unix does.

Connectez-vous pour commenter.

Walter Roberson
Walter Roberson le 13 Sep 2011

Oleg Komarov
Oleg Komarov le 25 Nov 2014
An addition to the list by Jan FEX: passfield.

sonali mishra
sonali mishra le 8 Déc 2017
how to make the password hide?? and i also want to make a userID box with this password box... can u help me how to create these.....
  1 commentaire
Walter Roberson
Walter Roberson le 8 Déc 2017
Several of the file exchange contributions listed in the above responses hide the answer.

Connectez-vous pour commenter.


En savoir plus sur Programming Utilities dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by