Products & Services Industries Academia Support User Community Company

Learn more about MATLAB   

Editor

Editing MATLAB Code Files

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.

Identifying Problems and Areas for Improvement

Use code analysis to help you write correct and efficient MATLAB code. Code analysis:

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.

Publishing MATLAB Code Files

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®.

  


Recommended Products

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