This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/programming/code/logicalVector.m

13 lines
234 B
Matlab

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)