%% Test Vector Elements
% Determine if vector elements are less than a given value.
% Create a numeric vector.

A = [1 12 18 7 9 11 2 15];

%
% Test the vector for elements that are less than 12.

A < 12

% The result is a vector with values of logical 1 (true) where the elements of A satisfy the expression.
%
% Use the vector of logical values as an index to view the values in A that are less than 12.

A(A < 12)

% The result is a subset of the elements in A.
% Copyright 2012 The MathWorks, Inc.