Get from Ico-github-logo

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

  • launchEnigma
    LAUNCHENIGMA - Starts the Enigma User Interface
  • enigma
  • enigmaApp
  • enigmaReflectors
  • enigmaRotorUI
    Handle class for the spinning of Enigma Machine rotors
  • enigmaRotors
  • plugBoard
    This class is a plugBoard
  • plugBoardTable
    Table tool for modifying plugboard configuration.
  • startHere.m
    STARTHERE - Script to describe how users can interface with the Enigma
  • View all files
5.0 | 7 ratings Rate this file 16 Downloads (last 30 days) File Size: 6.14 MB File ID: #51009 Version: 1.1
image thumbnail




17 Jun 2015 (Updated )

Enigma M3 Emulator

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

Enigma M3 Emulator
This is a MATLAB App for simulating the Enigma encryption machine. It specifically emulates the M3 variant of the machine used during World War II by the German army.
To run the app, type the following at the MATLAB command prompt:


Perform encryption/decryption by clicking on the round keys at the bottom of the machine. Your input and the machines output will be recorded on the tablet on the right of the App. Keyboard input can also be used.

You can configure the machine in a variety of ways. Click the rotor icon on the top-right of the machine to modify the :
•rotor types
•ring offsets of the rotors
•reflector type
•plugboard connections

You can also modify the position of the rotors by hovering over the rotor images and using the scroll-wheel of the mouse or dragging up or down with the left mouse button pressed.

You can also run the simulation completely from the MATLAB command line. See the startHere.m file for a demonstration.

Related links:
    Alan Turing and His Connections to MATLAB

    The Enigma Machine and MATLAB

Contributors to this App were Corey Lagunowich, Cesar Rivadeneyra, Adam Sifounakis and Sean de Wolski

Required Products MATLAB
MATLAB release MATLAB 8.5 (R2015a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (13)
11 Jan 2017 David MERCIER

24 Jun 2016 Hans Wyssmann


I am new to Mathlab. I have downloaded the folder mathworks-Enigma-cdb1a4c. How do I launch the app ? Do I have to move the folder to some place ?

Thank you for your help


Comment only
28 Feb 2016 Dave Polidori

@MattBrauer -- thanks, that solved my problem. Love the program. Great work.

Comment only
26 Feb 2016 Matt Brauer

@Dave Polidori, it looks like a version compatibility problem. Please apply the suggestion from Yaroslav's comment (26 Oct 2015)

Comment only
26 Feb 2016 Teodo

Teodo (view profile)

@Matt Brauer Thank You for the answer/clarification. I have tried (earlier) the way You mentioned, but it was still not working for me. Even, I had problems if all folders were not in the "C:\Users\[Your User Name]\Documents\MATLAB", but in some sub-folder... Possible problem on my side - in my installation folder/conflict.

Anyway, now is working, and I sincerely am amazed how You authors had made it. For every respect. figuring out how Enigma works is a pretty difficult task - even with today explanations from many sources on web... BUT, make it work flawlessly under MATLAB, it is for every respect. Once more, thank You all for the great coding and application.

26 Feb 2016 Matt Brauer

@Teodo, sorry to hear that you had problems getting the app running. To clarify, it's not necessary to run the app from MATLAB's root folder. It's only necessary to run the app while your current working directory (what is returned by PWD and shown in the top navigation bar) is the parent directory of the app.

Comment only
26 Feb 2016 Dave Polidori

I can't figure out how to get this to work. If someone can help me, I would appreciate it. My 9 year old son is doing a report on Alan Turing and this would be great for him.

I tried on both a Mac and a PC and I keep getting error messages about not finding files or other issues. On the Mac, I moved the mathworks-Enigma-cdb1a4c folder into the MATLAB folder, added it to the path, and changed the working directory to be that folder. When I launch the app, I get this warning:

Error using drawnow
Unknown command option.

Error in enigmaApp/createFigure (line 29)

Error in enigmaApp/createMachineSection (line 17)

Error in enigmaApp (line 162)

Error in launchEnigma (line 7)

Comment only
24 Feb 2016 Teodo

Teodo (view profile)

I grasped with the problem for hours now... trial and error method. :-) Problem solved, sorry to bother You before. Please delete my comment - if not needed by others.

Solution: You must put ALL the app files in ROOT folder: "C:\Users\[Your User Name]\Documents\MATLAB", and of course - add it to main path (if it is not already in default path location). Files must not be in the originating folder, but rather only in root of the main path. It is NOT enough to add some other folder as a path! At least, it was for me like that, and Windows 7 Ultimate OS. Furthermore, there is a problem adding - to the path, the folder named: "images" - even if you add it to path correctly.

Thank You (to ALL authors), for the great app, in GUI as well!

24 Feb 2016 Teodo

Teodo (view profile)

This is a great app, and thank You for sharing. i have tested in the command window, but still having problems to start it in GUI mode. Even, with the version of 18.02.2016. All the paths and sub-folders are added correctly, and again, the app in M3 emulator mode is working flawlessly. I am using Matlab 2015b Academic License.

Now, the output in command window is the following:


>> launchEnigma
Error using imread (line 349)
File "@enigmaRotorUI\images\blankGauge.png" does not exist.

Error in enigmaApp/createRotorSection (line 14)
img = imread(fullfile('@enigmaRotorUI','images','blankGauge.png'));

Error in enigmaApp/createMachineSection (line 19)

Error in enigmaApp (line 162)

Error in launchEnigma (line 7)
enigmaApp; "

Can You help me please? Would really love to see this app in GUI mode, where MATLAB is under the hood (engine).

Thank You in advance.


22 Feb 2016 Diego Renza Torres

01 Feb 2016 Matt Brauer

As pointed out in a MATLAB Answer question, the app uses relative paths to define the location of certain images. This requires that MATLAB's working directory is the parent directory of the application's files (where launchEnigma.m resides). We will track this issue on the Git repository and look at submitting an enhancement. Sorry for the inconvenience.

Comment only
04 Nov 2015 Muthu Annamalai

26 Oct 2015 Yaroslav


This is a great app. Excellent to learn good OOP and GUI practices with MATLAB.

Just a small compatibility issue: in @enigmaApp/resizeFigureToFitScreen.m the line
<code> drawnow('limitrate','nocallbacks')
should be replaced with
try % MATLAB 2015b
catch % Earlier Matlab releases
in order to work with MATLAB R2014b.

17 Nov 2015 1.1

Added image and modified description

18 Feb 2016 1.1

Added links in the Description

Contact us