Chapter 4: Programming with MATLAB - FET
Chapter 4: Programming with MATLAB - FET
Chapter 4: Programming with MATLAB - FET
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
The continue Statement<br />
The following code uses a continue statement to<br />
avoid computing the logarithm of a negative number.<br />
x = [10,1000,-10,100];<br />
y = NaN*x;<br />
for k = 1:length(x)<br />
if x(k) < 0<br />
continue<br />
end<br />
y(k) = log10(x(k));<br />
end<br />
y<br />
The result is y = 1, 3, NaN, 2.<br />
Z.R.K<br />
4-26 More See pages 210-217.