%% Add Rules Using Membership Function Indices
% Load fuzzy inference system (FIS) and clear the existing rules.

fis = readfis('mam22.fis');
fis.Rules = [];

%
% Specify the following rules using membership function indices:
% If angle is small and velocity is big, then force is negBig and force2 is posBig2.
% If angle is not small and velocity is small, then force is posSmall and force2 is negSmall2.

rule1 = [1 2 1 4 1 1];
rule2 = [-1 1 3 2 1 1];
rules = [rule1; rule2];

%
% Add the rules to the FIS.

fis2 = addRule(fis,rules);

% fis2 is equivalent to fis, except that the specified rules are added to the rule base.

fis2.Rules

%
% Copyright 2018 The MathWorks, Inc.