x = 1:10; %% creating a logical vector y = x < 5; fprintf('Logical vector y:\n'); y fprintf('Data type of y: %s\n', class(y)); %% Select all elements that are less than 5 fprintf('\nAll elemente of x that are less than 5:\n') x(y)