MATLAB POLYSPACE RELEASE NOTES Bedienungsanleitung Seite 145

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 240
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 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
Seitenansicht 144
1 2 ... 140 141 142 143 144 145 146 147 148 149 150 ... 239 240

Kommentare zu diesen Handbüchern

Keine Kommentare