320 likes | 474 Views
CSC115: Matlab Special Session. Dr. Zhen Jiang Computer Science Department West Chester University. Class information . Textbook Hanselman & Littlefield, “Mastering Matlab 7”, Prentice Hall, Upper Saddle River, NJ, 2005. Example on Page 6 Variable Keyword (reserved word) ;
E N D
CSC115: Matlab Special Session Dr. Zhen Jiang Computer Science Department West Chester University
Class information • Textbook • Hanselman & Littlefield, “Mastering Matlab 7”, Prentice Hall, Upper Saddle River, NJ, 2005.
Example on Page 6 • Variable • Keyword (reserved word) • ; • Calculation • % (comment) • , • error
<File> <new> • Or the direct access from the icon “blank”
Input / Output • Parameter input • Page 33
Xls input (the easiest one) • Sample xls input file • Page 250 • Also available at http://www.mathworks.com/access/helpdesk/help/techdoc/ref/xlsread.html
Something must know • Page 39 • How to use the readout n?
Apply an operation on every unit in the array • Page 47 • ` (especially useful to handle different input format, see the discussion later)
Standard arrays, page 54 • Ones, zeros, size, eye, rand, randn, diag • Repmat(pi, 3, 4)
Find(a>4, 2, ‘first’) • Page 189, such as a filter to discard NaN or InF • Max • Min • Size
Multidimensional array • 1-d => 2-d => 3-d, page 98 • 3-d => 2-d => 1-d, page 99 • Reshape(page 57), cat(page 101), flipdim, shiftdim, permute • Their search and sorting, such as a 3d array sorted in one dimension.
[p, q] • [ p q ] • Or cat (2, p, q) • [p; q] • Or cat (1, p, q)
Output • Standard output • Disp(), page 162 • Sprintf, page 168 • Plot, page 276
Other inputs • Sample plain text file • Help fileformats, page 253 • Tip: Try to avoid using low level file I/O