MATLAB Programming
MATLAB Programming MATLAB Programming
3 Basic Program Components Quantifiers (Continued) Operator expr+ q_expr* q_expr+ q_expr? Usage Match expr when it occurs 1 or more times consecutively. Equivalent to {1,}. Matchasmuchofthequantified expression as possible, where q_expr represents any of the expressions shown in the first six rows of this table. Matchasmuchofthequantified expression as possible, but do not rescan any portions of the string if the initial match fails. Matchonlyasmuchofthequantifiedexpressionas necessary. Ordinal Token Operators Operator (expr) Usage Capture in a token all characters matched by the expression within the parentheses. \N Match the N th token generated by this command. That is, use \1 to match the first token, \2 to match the second, and so on. 3-76
Regular Expressions Ordinal Token Operators (Continued) Operator Usage $N Insert the match for the N th tokeninthereplacement string. Used only by the regexprep function. If N is equal to zero, then insert the entire match in the replacement string. (?(N)s1|s2) If N th token is found, then match s1, elsematchs2 Named Token Operators Operator (?expr) \k Usage Capture in a token all characters matched by the expression within the parentheses. Assign a name to the token. Match the token referred to by name. 3-77
- 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
- Page 270 and 271: 3 Basic Program Components As a sim
- Page 272 and 273: 3 Basic Program Components ans = De
- Page 274 and 275: 3 Basic Program Components Operator
- Page 276 and 277: 3 Basic Program Components Operator
- Page 278 and 279: 3 Basic Program Components Conditio
- Page 280 and 281: 3 Basic Program Components ans = g1
- Page 282 and 283: 3 Basic Program Components The dyna
- Page 284 and 285: 3 Basic Program Components at each
- Page 286 and 287: 3 Basic Program Components function
- Page 288 and 289: 3 Basic Program Components Operator
- Page 290 and 291: 3 Basic Program Components Find con
- Page 292 and 293: 3 Basic Program Components statemen
- Page 294 and 295: 3 Basic Program Components Characte
- Page 298 and 299: 3 Basic Program Components Named To
- Page 300 and 301: 3 Basic Program Components Comma-Se
- Page 302 and 303: 3 Basic Program Components 40 Thisi
- Page 304 and 305: 3 Basic Program Components ans = 10
- Page 306 and 307: 3 Basic Program Components X = -pi:
- Page 308 and 309: 3 Basic Program Components Program
- Page 310 and 311: 3 Basic Program Components if A S1
- Page 312 and 313: 3 Basic Program Components end disp
- Page 314 and 315: 3 Basic Program Components while St
- Page 316 and 317: 3 Basic Program Components Program
- Page 318 and 319: 3 Basic Program Components Asterisk
- Page 320 and 321: 3 Basic Program Components Numeric
- Page 322 and 323: 3 Basic Program Components Cell Arr
- Page 324 and 325: 3 Basic Program Components Dynamic
- Page 326 and 327: 3 Basic Program Components The purp
- Page 328 and 329: 3 Basic Program Components Function
- Page 330 and 331: 3 Basic Program Components MATLAB F
- Page 332 and 333: 3 Basic Program Components Forcing
- Page 334 and 335: 4 M-File Programming Function Argum
- Page 336 and 337: 4 M-File Programming Saving the Pro
- Page 338 and 339: 4 M-File Programming Improving Perf
- Page 340 and 341: 4 M-File Programming Working with M
- Page 342 and 343: 4 M-File Programming Function Defin
- Page 344 and 345: 4 M-File Programming This is the fi
3 Basic Program Components<br />
Quantifiers (Continued)<br />
Operator<br />
expr+<br />
q_expr*<br />
q_expr+<br />
q_expr?<br />
Usage<br />
Match expr when it occurs 1 or more times<br />
consecutively. Equivalent to {1,}.<br />
Matchasmuchofthequantified expression as possible,<br />
where q_expr represents any of the expressions shown<br />
in the first six rows of this table.<br />
Matchasmuchofthequantified expression as possible,<br />
but do not rescan any portions of the string if the initial<br />
match fails.<br />
Matchonlyasmuchofthequantifiedexpressionas<br />
necessary.<br />
Ordinal Token Operators<br />
Operator<br />
(expr)<br />
Usage<br />
Capture in a token all characters matched by the<br />
expression within the parentheses.<br />
\N Match the N th token generated by this command. That is,<br />
use \1 to match the first token, \2 to match the second,<br />
and so on.<br />
3-76