% Create Array a = 1:10 % Extract 3-6th Elements a(3:6) %3 4 5 6 % Get True/False Array (a > 5) % 0 0 0 0 0 1 1 1 1 1 % Get Sub-Array b = a(a > 5) % 6 7 8 9 10 % Change Array by Conditions a(a > 5) = 0 % 1 2 3 4 5 0 0 0 0 0
% Delete a = magic(3) a(2, :) = [] % delete the second row a(:, 2) = [] % delete the second column % Add b = magic(3); b(4, :) = 1:3 % insert a row to the end b(:, 4) = [1; 2; 3; 4] % insert a column to the end b = [b; 1:2:8] % insert row