%% Terminate Conditional Statement and for Loop
% Use end to close an if statement and a for loop. The first instance of end pairs with the if statement, and the second pairs with the for statement.

a = [0 0 1 1 0 0 0 1 0];
for k = 1:length(a)
    if a(k) == 0
        a(k) = 2;
    end
end

%
% Copyright 2012 The MathWorks, Inc.