MATLAB Programming
MATLAB Programming MATLAB Programming
2 Data Types 2-120
3 Basic Program Components This chapter introduces some of the principal building blocks used in writing MATLAB programs. Variables (p. 3-3) Keywords (p. 3-14) Special Values (p. 3-15) Operators (p. 3-17) MATLAB Expressions (p. 3-28) Regular Expressions (p. 3-31) Comma-Separated Lists (p. 3-80) Program Control Statements (p. 3-88) Guidelines for creating variables; global and persistent variables; variable scope and lifetime Reserved words that you should avoid using Functions that return constant values, like pi or inf Arithmetic, relational, and logical operators Executing user-supplied strings; constructing executable strings, shell escape functions A versatile way to search and replace character strings Using lists with structures and cell arrays to simplify your code Using statements such as if, for, and try-catch to control the code path your program follows
- Page 170 and 171: 2 Data Types • The day field is a
- Page 172 and 173: 2 Data Types datestr(d) ans = 01-Ma
- Page 174 and 175: 2 Data Types Utility Functions (Con
- Page 176 and 177: 2 Data Types • “Applying Functi
- Page 178 and 179: 2 Data Types where the arguments ar
- Page 180 and 181: 2 Data Types You can access subarra
- Page 182 and 183: 2 Data Types Dynamic Field Names Ex
- Page 184 and 185: 2 Data Types Deleting Fields from S
- Page 186 and 187: 2 Data Types plot(mercury, 'b') plo
- Page 188 and 189: 2 Data Types There are at least two
- Page 190 and 191: 2 Data Types Element-by-element org
- Page 192 and 193: 2 Data Types Nesting Structures A s
- Page 194 and 195: 2 Data Types Cell Arrays A cell arr
- Page 196 and 197: 2 Data Types Operation Syntax Descr
- Page 198 and 199: 2 Data Types 3-by-3 Cell Array Note
- Page 200 and 201: 2 Data Types C5 = 'Jan' 'Feb' 'Mar'
- Page 202 and 203: 2 Data Types of an array without re
- Page 204 and 205: 2 Data Types Createa1-by-2arraywith
- Page 206 and 207: 2 Data Types ans = 7 ans = 2 ans =
- Page 208 and 209: 2 Data Types 3 4 B = reshape(A, 6,
- Page 210 and 211: 2 Data Types A{1,1} = [1 2; 3 4]; A
- Page 212 and 213: 2 Data Types [5x5 double] {2x2 cell
- Page 214 and 215: 2 Data Types G = cell(1,16); for m
- Page 216 and 217: 2 Data Types Function Handles A fun
- Page 218 and 219: 2 Data Types MATLAB Classes All MAT
- Page 222 and 223: 3 Basic Program Components Symbol R
- Page 224 and 225: 3 Basic Program Components Note If
- Page 226 and 227: 3 Basic Program Components Another
- Page 228 and 229: 3 Basic Program Components Verifyin
- Page 230 and 231: 3 Basic Program Components function
- Page 232 and 233: 3 Basic Program Components Evaluati
- Page 234 and 235: 3 Basic Program Components Keywords
- Page 236 and 237: 3 Basic Program Components Hereares
- Page 238 and 239: 3 Basic Program Components Operator
- Page 240 and 241: 3 Basic Program Components To test
- Page 242 and 243: 3 Basic Program Components Function
- Page 244 and 245: 3 Basic Program Components 5 11 10
- Page 246 and 247: 3 Basic Program Components Advantag
- Page 248 and 249: 3 Basic Program Components MATLAB E
- Page 250 and 251: 3 Basic Program Components This M-f
- Page 252 and 253: 3 Basic Program Components • “S
- Page 254 and 255: 3 Basic Program Components Operator
- Page 256 and 257: 3 Basic Program Components Word and
- Page 258 and 259: 3 Basic Program Components There ar
- Page 260 and 261: 3 Basic Program Components regexp(p
- Page 262 and 263: 3 Basic Program Components s = e =
- Page 264 and 265: 3 Basic Program Components ¥ dolla
- Page 266 and 267: 3 Basic Program Components Operator
- Page 268 and 269: 3 Basic Program Components Exact, M
3<br />
Basic Program Components<br />
This chapter introduces some of the principal building blocks used in writing<br />
<strong>MATLAB</strong> programs.<br />
Variables (p. 3-3)<br />
Keywords (p. 3-14)<br />
Special Values (p. 3-15)<br />
Operators (p. 3-17)<br />
<strong>MATLAB</strong> Expressions (p. 3-28)<br />
Regular Expressions (p. 3-31)<br />
Comma-Separated Lists (p. 3-80)<br />
Program Control Statements<br />
(p. 3-88)<br />
Guidelines for creating variables;<br />
global and persistent variables;<br />
variable scope and lifetime<br />
Reserved words that you should<br />
avoid using<br />
Functions that return constant<br />
values, like pi or inf<br />
Arithmetic, relational, and logical<br />
operators<br />
Executing user-supplied strings;<br />
constructing executable strings,<br />
shell escape functions<br />
A versatile way to search and replace<br />
character strings<br />
Using lists with structures and cell<br />
arrays to simplify your code<br />
Using statements such as if, for,<br />
and try-catch to control the code<br />
path your program follows