Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Bashuk Kirill / lab3_arch.docx
Скачиваний:
8
Добавлен:
20.02.2016
Размер:
409.37 Кб
Скачать

Variable Editor

Double-click a variable in the Workspace browser, or use open var Variable name, to see it in the Variable Editor. Fig 5

Use the Variable Editor to view and edit a visual representation of variables in the workspace.

Fig.5 Variable Editor

Editor

Editing M-Files

Fig.6 Set Path dialog box

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. Fig 6

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” on page 7-25.

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” in the MATLAB Desktop Tools and Development Environment documentation, and the function reference pages for edit, type, and debug.

Publishing M-Files

Fig.7 Publishing M-Files

While or after you create an M-file, you can use the Editor’s Cell > Insert Text Markup Fig.7 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, and LaTeX. 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.

Improving and Tuning M-Files

Finding Errors Using the M-Lint Code Report

The M-Lint Code Check Report displays potential errors and problems, as well as opportunities for improvement in your M-files. The term lint is used by similar tools in other programming languages such as C.

Access the M-Lint Code Check Report and other reports from the Current Directory browser. You run a report for all files in the current directory

The M-Lint Code Check Report displays a message for each line of an M-file it determines might be improved. For example, a common M-Lint message is that a variable is defined but never used in the M-file.

To open the M-file in the Editor at the line indicated, click the line number.

Fig.8 M-Lint Code report

Alternatively, you can use automatic M-Lint code checking to view M-Lint messages while you work on a file in the Editor. You can also use the mlint function to get results for a single M-file. Fig.8

For More Information See “Tuning and Managing M-Files” and “M-Lint Code Analyzer” in the MATLAB Desktop Tools and Development Environment documentation, and the reference page for the mlint function.

Соседние файлы в папке Bashuk Kirill