Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档 > MATLAB技术文章
MATLAB技术文章 MATLAB Technical Articles From Mathworks
回复
 
主题工具 显示模式
旧 2008-04-18, 22:30   #1
TechnicalArticles
游客
 
帖子: n/a
默认 Increasing Your Productivity with the MATLAB Desktop

By Kevin Cohan
The MATLAB Desktop development environment offers interactive editors, browsers, and other tools to help you create, edit, and manage your data and programs (Figure 1).

Figure 1. A typical MATLAB Desktop layout. Click on image to see enlarged view.
This article and the accompanying videos show how you can take advantage of many of these features and get the most out of the Desktop. All the examples were created using MATLAB 7.5, part of Release 2007b.
Managing the Desktop Layout

Each of us manages our desktop differently, and we often vary the desktop layout from project to project. The MATLAB Desktop makes layout customization easy. You can move or hide specific tools and then save the revised layouts for reuse. You can maximize a window to bring a particular tool into focus and then just as quickly return to the previous view.

Video 1. Window management features within the MATLAB Desktop. To play the video, click on the image. (2 min, 52 sec)
Editing Programs and Scripts

The MATLAB Editor/Debugger provides a number of features for creating and editing MATLAB programs and scripts.
Cell mode lets you segment your program or script into sections that can be individually executed. This feature provides a convenient method for rapidly stepping through different sections of code in an interactive fashion. Each cell is denoted by the use of a “%%” at the start of a line. Preferences let you control the way cells are displayed. With cell mode you can automatically publish your code, comments, and results in HTML, Word, LaTEX, and other formats.
Delimiter matching highlights matched and unmatched delimiters, such as parentheses ( ), brackets [ ], braces { }, and paired language keywords (if, while, else and end statements), based on the syntax rules of the MATLAB language.
Code folding lets you hide functions that you are not working on currently, making your programs much more readable and easier to maintain.
Split screen display lets you simultaneously view different parts of a file, making it easier to compare sections of a program or to cut and paste from one section to another.
Run configurations let you run functions directly from the Editor rather than in the Command window by providing values for the function inputs in a configuration. Each function can have multiple configurations that are preserved from session to session.
Navigation features let you quickly move between large numbers of subfunctions or nested functions using the function dropdown on the toolbar within the Editor, the “Go To” dialog in the Go menu, or the Open Selection feature. This last option lets you jump from the point in your program where a function is used to the point where it is defined. You can then return to your starting point by using the Back button within the Editor toolbar.
Once you have a working program, you can use M-Lint and the Profiler to improve your code.
M-Lint analyzes your code, checking for problems and recommending changes to maximize performance and maintainability. You can configure M-Lint to provide constant visual feedback or to generate a report.
The Profiler generates a detailed summary indicating where your program is spending the most time during execution. You can use the information to tune, optimize, and debug your code.

Video 2. Using the Editor/Debugger to create and edit MATLAB programs. To play the video, click on the image. (8 min, 6 sec)
Working from the Keyboard

Many users find that they work more productively when they minimize their use of the mouse. You can access virtually all MATLAB Desktop functionality without leaving the keyboard.
Tab Completion

If you're unsure of a function, variable, or file name, simply type the first few characters of the item and then press Tab. Tab completion provides a list of options based on the characters that you’ve typed. If MATLAB finds a unique result, it fills it in. If the search produces more than one result, then a list of options is displayed (Figure 2). This feature works in the Command Window and in the Editor.

Figure 2. Tab Completion within the Command Window.
Quick Help

Turn to Quick Help if you know the name of a function but not its syntax. By positioning your cursor on the function of interest and pressing F1, you bring up the reference page for that function in a pop-up window. You can use Quick Help in the Command Window or the Editor (Figure 3).

Figure 3. Using Quick Help within the Command Window.
Keyboard Shortcuts

Built-in keyboard shortcuts let you use the keyboard to perform tasks that are more commonly associated with the mouse. For example, you can:
  • Access menu items through accelerators or hot keys
  • Fill in and execute dialog boxes by using the Tab key (to move to the next button or field), the spacebar (to activate the current button), and the Enter key (to execute the default button)
  • Navigate the Desktop using short cuts including Ctrl+Tab (to move to the next open tool), Ctrl + Page Down (to move to the next tool within a group of tabbed tools), Ctrl+0 (to move to the Command Window), and Ctrl+Shift+0 (to move to the Editor)
For a complete list of keyboard shortcuts, see the MATLAB documentation.

Video 3. Navigating the Desktop without leaving the keyboard. To play the video, click on the image. (3 min, 39 sec)
Automating Tasks

If you need to repeat your analysis on new data or refine your analysis methods, the Desktop speeds this process by enabling you to automate previously completed work.
Command History

Rarely does a single sequence of steps provide the perfect solution. More often, a final solution is the result of trial and error. The Command History, which contains a log of the most recently run commands, makes it easy to capture the final solution. You can copy the relevant commands into a script, which can then be used to automate the interactive steps previously taken.
Shortcuts

Shortcuts provide an easy way to repeat a small number of frequently used MATLAB commands. One popular use for shortcuts is to manage your desktop by switching between projects or clearing out your workspace. You can access the shortcuts in the Shortcuts toolbar and from the MATLAB Start button.

Video 4. Automating tasks in MATLAB. To play the video, click on the image. (3 min, 13 sec)
Learning More About the MATLAB Desktop

This article covered a subset of the many features and capabilities available with the MATLAB Desktop. More features are added with each release. "Inside the MATLAB Desktop," a blog on MATLAB Central, gives you an opportunity to learn about these features directly from the Desktop developers. We encourage you to visit "Inside the MATLAB Desktop" and the other resources listed below to ensure that you’re getting the most out of your Desktop.


更多...
  回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 05:10


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.