Use the pathname edit box to view Click the find button to search for content within M-files directories and their contents 口区 dow Help D: \mymfiles All files File Type Last Modified Descriptio Double-click afile results Folder 23-1un-20004:55PM to open it in an propriate tool caution. mdl 13-Noy-19972:43PM Ed collatz. m M-file 1-J]un-2000 1: 21 PM Collatz prc EE coll atzplot m M-file 15-Jun-2000 4: 42 PM Plot lengt 20-Dec-19993:19PM 国fa11ing,m 10-Dec-19994:24 M-file 06-Mar-2000 3: 04 PM FINISHDLG 自knts.ma MAT-千11e 19-Apr-20004:48PM portion of the B BUCKY 75 the selected m-file m:, Search path MATLAB uses a search path to find M-files and other MATLAB-related files which are organized in directories on your file system. Any file you want to run in MatLAB must reside in the current directory or in a directory that is on the search path. Add the directories containing files you create to the maTLAB search path. By default, the files supplied with MATLAB and Math Works cluded in the To see which directories are on the search path or to change the search path select Set Path from the File menu in the desktop, and use the Set Path dialog box. Alternatively, you can use the path function to view the search path, addpath to add directories to the path, and rmpath to remove directories from the path 2-11
Desktop Tools 2-11 Search Path MATLAB uses a search path to find M-files and other MATLAB-related files, which are organized in directories on your file system. Any file you want to run in MATLAB must reside in the current directory or in a directory that is on the search path. Add the directories containing files you create to the MATLAB search path. By default, the files supplied with MATLAB and MathWorks toolboxes are included in the search path. To see which directories are on the search path or to change the search path, select Set Path from the File menu in the desktop, and use the Set Path dialog box. Alternatively, you can use the path function to view the search path, addpath to add directories to the path, and rmpath to remove directories from the path. Use the pathname edit box to view directories and their contents Click the find button to search for content within M-files Double-click a file to open it in an appropriate tool. View the help portion of the selected M-file
Development Environmen Workspace Browser The MATLAB workspace consists of the set of variables(named arrays ) built up during a matlAB session and stored in memory. You add variables to the workspace by using functions, running M-files, and loading saved workspaces To view the workspace and information about each variable use the Workspace browser or use the functions who and whos ile Edit View Web Window 团暗stka Class Double-click a ble array 田田田田回图围田 Ceg cell array double array (global) contents in array the arre double array (logical) inline object 1x1 psu struct array To delete variables from the workspace, select the variable and select Delete from the Edit menu. Alternatively, use the clear function. The workspace is not maintained after you end the matlAB session. To save he workspace to a file that can be read during a later MatLAB session, select Save Workspace As from the File menu, or use the save function. This saves the workspace to a binary file called a MAt-file, which has a. mat extension. There are options for saving to different formats To read in a Mat-file, select Import Data from the File menu, or use the load function Double-click a variable in the workspace browser to see it in the array editor Use the array editor to view and edit a visual representation of one-or 2-12
2 Development Environment 2-12 Workspace Browser The MATLAB workspace consists of the set of variables (named arrays) built up during a MATLAB session and stored in memory. You add variables to the workspace by using functions, running M-files, and loading saved workspaces. To view the workspace and information about each variable, use the Workspace browser, or use the functions who and whos. To delete variables from the workspace, select the variable and select Delete from the Edit menu. Alternatively, use the clear function. The workspace is not maintained after you end the MATLAB session. To save the workspace to a file that can be read during a later MATLAB session, select Save Workspace As from the File menu, or use the save function. This saves the workspace to a binary file called a MAT-file, which has a .mat extension. There are options for saving to different formats. To read in a MAT-file, select Import Data from the File menu, or use the load function. Array Editor Double-click a variable in the Workspace browser to see it in the Array Editor. Use the Array Editor to view and edit a visual representation of one- or Double-click a variable to see and change its contents in the Array Editor
Desktop Tool two-dimensional numeric arrays, strings, and cell arrays of strings that are in Change values of array elements. Change the display format 网口区 Eile\ Edit Yiew Web Window Help o eh e Numeric fomat short 3 Size: 4- 国口 Array Editor: m [Array Editor: x_Array Editor: the R Use the tabs to view the variables you have open in the array editor. 2-13
Desktop Tools 2-13 two-dimensional numeric arrays, strings, and cell arrays of strings that are in the workspace. Change values of array elements. Change the display format. Use the tabs to view the variables you have open in the Array Editor
Development Environmen Editor/Debugger Use the Editor/Debugger to create and debug M-files, which are programs you write to run MATLAB functions. The Editor/Debugger provides a graphical user interface for basic text editing, as well as for M-file debugging Comment selected lines and specify indenting style using the Text menu. Find and replace strings 9)D\mymfiles\collatz.m Eile Edit yiew Iext Debug Breakppints Web Window Help 口回M鹛。舀升.日君萄s s Collatz problem. Generate a sequence of integers resolving to l where you want i For any positive integer, n: execution to 4 Divide n by 2 if n is even Multiply n by 3 and add 1 if n 13 odd so you can e t Repeat for the result Continue until the result is I go+ sequence Hold the cursor over next varr variable and its12 hile next current value if rem(n appears (known as ext value s next value /2 a datatip) next value 3*next value sequence =[sequence, next value 18-end You can use any text editor to create M-files, such as Emacs, and can use preferences(accessible from the desktop File menu) to specify that editor the default. If you use another editor, you can still use the matlab Editor/Debugger 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 it in the Command window by using the type function 2-14
2 Development Environment 2-14 Editor/Debugger Use the Editor/Debugger to create and debug M-files, which are programs you write to run MATLAB functions. The Editor/Debugger provides a graphical user interface for basic text editing, as well as for M-file debugging. You can use any text editor to create M-files, such as Emacs, and can use preferences (accessible from the desktop File menu) to specify that editor as the default. If you use another editor, you can still use the MATLAB Editor/Debugger 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 it in the Command Window by using the type function. Set breakpoints where you want execution to pause so you can examine variables. Comment selected lines and specify indenting style using the Text menu. Find and replace strings. Hold the cursor over a variable and its current value appears (known as a datatip)
Profiler MATLAB includes a graphical user interface, the profiler, to help you improve the pe ce of your M-files 1 Type profile viewer to open the 3 Click Start Eile Epit yiew Web Window Help Start Profiling Run this code ● Profile time:0sec mproving M-File Performance-the Profiler the performance of your M-files is to profile them. MATLAB rovides an M-file profiler that lets you see how much computation time each line of an M-file uses For details on how to use the profiler see the profiler documentation For more information, see"Maximizing Performance"in the matLAB documentation
Desktop Tools 2-15 Profiler MATLAB includes a graphical user interface, the Profiler, to help you improve the performance of your M-files. For more information, see “Maximizing Performance” in the MATLAB documentation. 2 Enter statement to 3 Click Start 1 Type profile viewer to open the