![]() It is important to note that MATLAB indexes matrices in the following manner: Vectors and scalars are initialized the same way as matrices. (In MATLAB 4, the * operator is not required in complex numbers, as it was in previous versions.) In the example above, the expression 4 + 5i, with the + sign surrounded by blanks, would represent two separate numbers. When entering complex numbers as matrix elements within brackets, it is important to not use blanks. You can also initialize matrices with complex numbers: (Note: You can also use the semicolon after an expression or statement to suppress printing or to separate statements.) Within the square brackets that are used to form vectors and matrices, you can use a semicolon to end a row. Where each value may be rational or complex numbers. The most straightforward way to initialize a matrix is to type a command of the form: Start the program from Windows or Mac OSX. You need to be on CMU network or VPN to CMU network to use MATLAB. To prevent long descriptions from scrolling off the screen before you have time to read them, enter more on, and then enter the help function.Greatly borrowed from MIT's MATLAB on Athena tutorial () To do so, simply follow the format used in an existing Contents.m file. If you create directories in which to store your own M-files, you should create Contents.m files for them too. The lookfor function searches and displays this line, and help displays these lines in directories that do not contain a Contents.m file.Ĭreating Contents Files for Your Own M-File DirectoriesĪ Contents.m file is provided for each M-file directory included with the MATLAB software. It should contain the function name and a brief description of the function. The first comment line in any M-file (the H1 line) is special. Any later comments in the M-file do not appear when you type help for the function. After the first contiguous comment lines, enter an executable statement or blank line, which effectively ends the help section. These lines are the first block of contiguous comment lines. When you execute help angle, lines 2, 3, and 4 display. % ANGLE(H) returns the phase angles, in radians, of a matrix ![]() ![]() For example, an abridged version of the M-file angle.m provided with MATLAB could contain Typing help topic, where topic is a function name, displays help for the function by listing the first contiguous comment lines in the M-file topic.m.Ĭreate self-documenting online help for your own M-files by entering text on one or more contiguous comment lines, beginning with the second line of the file (first line if it is a script). If a contents file does not exist, help displays the H1 lines of all the files in the directory. Typing help topic, where topic is a directory name, displays the comment lines in the Contents.m file located in that directory. The contents files are the M-files named Contents.m within each directory. The help function lists all help topics by displaying the first line (the H1 line) of the contents files in each directory on the MATLAB search path. You can write help descriptions for your own M-files and toolboxes using the same self-documenting method that MATLAB M-files and toolboxes use. The MATLAB help system, like MATLAB itself, is highly extensible. For example, the javaObject function uses mixed case.Ĭreating Online Help for Your Own M-Files Some functions for interfacing to Java do use mixed case the M-file help accurately reflects that and you should use mixed case when typing them. When typing function names, however, use lowercase characters. M-file help displayed in the Command Window uses all uppercase characters for the function and variable names to make them stand out from the rest of the text. It is not necessary to give the full pathname of the directory the last component, or the last several components, are sufficient.ĭisplays the M-file help for function that belongs to the toolbox directory.ĭisplays M-file help describing the syntax used in MATLAB commands and functions. If function is overloaded, help displays the M-file help for the first function found on the search path, and lists the overloaded functions.ĭisplays the contents file for the specified directory named toolbox. Lists all operators and special characters, along with their descriptions.ĭisplays M-file help, which is a brief description and the syntax for function, in the Command Window. Each main help topic corresponds to a directory name on the MATLAB search path. Lists all primary help topics in the Command Window. Help (MATLAB Functions) MATLAB Function Referenceĭisplay help for MATLAB functions in Command Window
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |