| Products & Services | Solutions | 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 M-files, which are programs you write to run MATLAB functions. The Editor provides a graphical user interface for text editing, as well as for M-file debugging. To create or edit an M-file use File > New or File > Open, or use the edit function.

You can use any text editor to create M-files, such as Emacs. Use Editor/Debugger preferences (accessible from the desktop by selecting File > Preferences > Editor/Debugger) to specify that editor as the default. If you use another editor, you can still 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 an M-file, you can display the contents in the Command Window using the type function.
Use the M-Lint automatic code analyzer to help you identify problems and potential improvements in your code. For details, see Improving and Tuning M-Files.
You can evaluate your code in sections, called cells, and can publish your code, including results, to popular output formats like HTML. For more information, see Using Cells for Rapid Code Iteration and Publishing Results in the MATLAB Desktop Tools and Development Environment documentation.
For More Information See Editing and Debugging M-Files as well as the function reference pages for edit, type, and the list of debug functions. |
While or after you create an M-file, you can use the Editor's Cell > Insert Text Markup menu options to specify the formatting you want for publishing the M-file to various output types. For example, you might want to publish an M-file to present it at a meeting, include it in a blog, or share it 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 M-Files to HTML, XML, LaTeX, and PDF. If your system is a personal computer (PC), you also can publish M-Files to Microsoft Word and PowerPoint®.
For More Information See Publishing M-Files in the MATLAB Desktop Tools and Development Environment documentation, and the function reference pages for publish. |
![]() | Finding and Getting Files Created by Other Users — File Exchange | Improving and Tuning M-Files | ![]() |

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