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.