File Exchange

image thumbnail


version (3.63 KB) by Jeremy Smith
Login dialog with asterisk hidden password.


Updated 28 Jan 2010

View Version History

View License

Editor's Note: This was a File Exchange Pick of the Week

This is a login dialog which replaces all characters typed into the password area with asterisks. Both the login and password are returned by the function as strings.

Version information can be found in the m-file. Examples can be found in the m-file help.

Note: The password is only visually hidden. While the dialog is active it is stored in the Userdata of the password edit box.

Cite As

Jeremy Smith (2021). login (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (23)

Alexey Budkov

Maybe it worked in earlier versions, but in 2019a password field is not obfuscated, password string is mirrored (when typing 'abc' one will see 'cba'), if something is deleted from the password string - depending on the action several white-spaces are added and the string will be something like 'abc abc'.



Nice but how can i add in one more field "Username" into the codings? i have no idea at all >.<

nandini nandini b s

pls send the activation key fr 2013b version

Meenakshi Rajarajan

I am going to do project on Image processing using matlab.Can anyone sir/madam pls tell which topic is better for good results?And explain how to learn matlab code for image processing?

ash ver

I get an error undefined function gui_main. I am new to matlab. Can someone pls explain how do i use this file.
I have made a myscript.m file that i want now should prompt a user for a password and it should be displayed as encrypted password. At present I tried creating file witht the same code as logindlg to see how it works and if I can call functiosn from thsi file in myscript.m
Pls help.

Anjali M

Juan Chango

Muchas Gracias!


A great piece of code. Just a couple of small additions:

pressing the 'delete' key counts as a letter, rather than a eraser. I put the following string in there:

case 'delete'
password = password(1:end-1);

It's basically copying the backspace code, but it kind of makes it look a bit prettier, though don't think it's a full functionality.

Also, clicking the 'cancel' button basically just proceeds with the function. I used close(fig) rather than uiresume(fig) to close the dlg and disable access to the GUI.

Gael Dupire


File works perfectly. Just have to remembers to clear the username and password before saving anything so that no one can get a hold of your information.

Kent Conover

This function may not be secure for the beta release R2011a because the password is not obscured as it is typed. (Mac OSX 10.6.6).

Srikanth Sridharan

Hi. Great program, it works like a charm. However, I noticed that when I used it to input access details for a database (using the database command) I needed a little pause between using your code and creating the database object - otherwise Matlab (2009b) hangs.


Good one, it helped me a lot ..

Engr.Mohsin Khan

its help full but how to interface it with other GUI its good but how to utilizes with others

Austin Karathra

hi this is a good work.
But i cant run the code and it doesnt work for me in matlab6p1.
is it require an another version.

Hoi Wong

'Esc' key counts as a blank character. Is there any way to avoid that? Thanks for the great program

Luigi Rosa

Nice and useful application

Jeremy Smith

There is a problem with this script for versions of Matlab before 7.1. The functionality of the 'cellfun' function changes so if you delete lines 45-48 it'll work as it should. Those lines are just responsible for some error checking.

Athiya Sulthana

My PC has Matlab ver 7.0.1 and this does not work...Dispalys an error and could not understand how to trouble shoot it. Hope u would help me in this regard....

Ankul Batra

nice work Jeremy :).......

Nhan Nguyen Thanh

Thank you very much!



MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!