MATLAB POLYSPACE RELEASE NOTES Manuale Utente Pagina 145

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 240
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 144
Flow Control
break
The bre ak statement lets you exit early from a for loop or while loop. In
nested loops,
break exits from the innermost loop only.
Here is an im provement on the example from the previous section. Why is
this use of
break a good idea?
a = 0; fa = -Inf;
b = 3; fb = Inf;
while b-a > ep s*b
x = (a+b)/2;
fx = x^3-2*x-5;
if fx == 0
break
elseif sign(fx) == sign(fa)
a = x; fa = fx;
else
b = x; fb = fx;
end
end
x
Error Control try, catch
This section covers those MATLAB functions that provide error handling
control.
try
The general form of a try-catch statement sequence is
try
statement
...
statement
catch
statement
...
statement
end
4-7
Vedere la pagina 144
1 2 ... 140 141 142 143 144 145 146 147 148 149 150 ... 239 240

Commenti su questo manuale

Nessun commento