| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
| On this page… |
|---|
Use the Editor to create and debug programs you write for running MATLAB functions. The Editor provides a graphical user interface for text editing and debugging MATLAB code. To create or edit a file use File > New or File > Open, or use the edit function.

You can use any text editor to create files, such as Emacs. Use Editor/Debugger preferences (accessible from the desktop by selecting File > Preferences > Editor/Debugger) to specify your default editor. If you use another editor, you still can use the MATLAB Editor for debugging, or you can use debugging functions, such as dbstop, which sets a breakpoint.
If you just need to view the contents of a file, display the contents in the Command Window using the type function.
Use code analysis to help you identify problems and potential improvements in your code. For details, see Improving and Tuning Your MATLAB Programs.
You can evaluate your code in sections (called code cells). Also, you can publish your code, including results, to popular output formats like HTML. For more information, see Using Code Cells for Rapid Code Iteration and Publishing Results in the MATLAB Desktop Tools and Development Environment documentation.
For More Information See Editing and Debugging MATLAB Code, the function reference pages for edit, type, and the list of Debugging Functions functions. |
Use code analysis to help you write correct and efficient MATLAB code. Code analysis:
Identifies areas for improvement by underlining code in orange
Identifies errors by underlining code in red
Provides short messages, called M-Lint messages, to describe all suspected trouble spots
Provides extended M-Lint messages for many suspected trouble spots
Provides automated fixes for many trouble spots
The following images show code with two messages at line 24. The link in the first message indicates that an extended message is available for that first problem. To have MATLAB fix a problem for you, click the Fix button.

When you click a message link, the message extends and provides a detailed explanation, a suggested action, and sometimes a link to the documentation.

For More Information See Checking for Coding Problems. |
While or after you create a MATLAB code file, you can use the Editor's Cell > Insert Text Markup menu options to specify the formatting you want for publishing the file to various output types. For example, you might want to publish a file to present at a meeting, include in a blog, or share with colleagues.

After adding text markup, click the Publish button
on the Editor toolbar. By default, MATLAB software
generates formatted HTML output and presents the document in the MATLAB Web
Browser.

You can publish MATLAB code files to HTML, XML, LaTeX, and PDF. If your system is a personal computer (PC), you also can publish files to Microsoft Word and PowerPoint®.
For More Information See Publishing MATLAB Code Files in the MATLAB Desktop Tools and Development Environment documentation, and the publish reference page. |
![]() | Finding and Getting Files Created by Other Users — File Exchange | Improving and Tuning Your MATLAB Programs | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |