MATLAB Live Editor

The MATLAB Live Editor provides a new way to create, edit, and run MATLAB code. See your results together with the code that produced them. Add equations, images, hyperlinks, and formatted text to enhance your narrative. Share with others as interactive documents.

Accelerate Exploratory Programming: Focus on your work in a single interactive environment for exploratory programming, data analysis, and algorithm development. Eliminate context switching and window management to accelerate time to insight.

Create an Interactive Narrative: Combine code, output, and formatted text to create an interactive narrative that describes your work.  Share your work in a way that can be easily reproduced, validated, and extended by others.

Teach with Interactive Documents: Create lectures that combine explanatory text, mathematical equations, code and results. Step through lecture topics one section at a time. Create live scripts with MATLAB code that students can use to explore complex material.


Live Editor Features

Create, edit, and run code in a single interactive environment. Generate results and graphics together with the code that produced them.

Use sections to divide a program or lecture into logical parts. Modify and run sections individually.

View output inline or on the right.

Find errors quickly at the line where they occurred. Fix the error and re-run the section.

Use titles, headings, and formatted text to tell a story as an interactive narrative.

Add equations that describe the mathematical or engineering basis for a calculation. Use images and hyperlinks as supporting information.

Add text in any language.

Share your live scripts with colleagues so they can reproduce or extend your results. Create PDF or HTML documents for publication.


Live Editor Examples

Introduction to the Live Editor

View a live script that shows how to:

  • Use the live editor to edit, run, and save live scripts
  • Show output together with the code that produced it
  • Create and run sections individually
  • Add formatted text, equations, images, and hyperlinks to create a sharable interactive narrative

Use the Live Editor to Accelerate Exploratory Programming

View a live script that shows how to:

  • See output together with the code that produced it
  • Divide your program into sections to evaluate blocks of code individually
  • Include visualizations
  • Experiment with parameter values
  • Summarize and share your findings

Create an Interactive Narrative with the Live Editor

View a live script that shows how to:

  • Use formatted text to describe the analysis
  • Use equations to describe the mathematics
  • Include images and hyperlinks for background material
  • Include plots for visualization.
  • Invite colleagues to extend your analysis

Teach with Live Scripts

View an example that shows to use live scripts in the classroom. You can:

  • Add equations to explain the underlying mathematics
  • Experiment with MATLAB code interactively
  • Include plots to illustrate important concepts
  • Use links and images to provide supporting information
  • Use live scripts for assignments

Selected Live Scripts from the MATLAB Community

Find community-authored live scripts on MATLAB Central File Exchange. Highlights include:


The Live Script File Format

MATLAB stores live scripts using a new file format with an .mlx extension. The live script file format uses Open Packaging Conventions technology, which is an extension of the zip file format. Code, output, and formatted content are stored using the Office Open XML (ECMA-376) format.

Live Scripts can be shared as PDF or HTML files. To share work from a live script with a colleague on a version of MATLAB prior to R2016a, save the file as a MATLAB code file (*.m).