tailieunhanh - Lecture note Data visualization - Chapter 20

This chapter presents the following content: Graphic window, edit window, start button, matrices in matlab, scalar operations, order of operations, array operations, matrix addition, matrix multiplication, number display (scientific notation), script m-files. | Lecture note Data visualization - Chapter 20 Lecture 20 Recap Graphic Window Edit Window Start Button Matrices in MATLAB Scalar Operations Order of Operations Array Operations Matrix Addition Types of M files Two types Script Function Script M file The script can use any variables that have been defined in the workspace and any variables created in the script are added to the workspace when the script executes A script created in the MATLAB edit window can be executed by selecting the Save and Run icon from the menu bar A script can be executed by typing a file name or by using the run command from the command window No matter how you do it you can only run an M file if it is in the current folder Editor Debugger Window Cell Mode It is a utility that allows the user to divide M files into sections or cells that can be executed one at a time This feature is particularly useful as develop MATLAB programs are developed To activate the cell mode select Cell gt Enable Cell Mode from the menu bar in the edit window Once the cell mode has been enabled the cell toolbar appears It s important to include the space after the double Continued . percentage sign . If don t the line is recognized as a comment not a cell divider Once the cell dividers are in place if cursor is positioned anywhere inside the cell the entire cell turns pale yellow Now use the evaluation icons on the cell toolbar to evaluate a single section evaluate the current section and move on to the next section or evaluate the entire file Also on the cell toolbar is an icon that lists all the cell titles in the M file Continued . By dividing the program into cells it was possible to work on each problem separately Be sure to save any M files developed this way by selecting Save or Save As from the file menu File gt Save or File gt Save As The reason for using these commands is that in cell mode the program is not automatically saved every time when it is run Summary of Chapter Chapter 3 Built in MATLAB .