MATLAB POLYSPACE RELEASE NOTES Manual do Utilizador Página 145

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 240
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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
Vista de página 144
1 2 ... 140 141 142 143 144 145 146 147 148 149 150 ... 239 240

Comentários a estes Manuais

Sem comentários