checkfis.m
来自「模糊控制工具箱,很好用的,有相应的说明文件,希望对大家有用!」· M 代码 · 共 52 行
M
52 行
function res = checkfis(fis);
% Copyright 2005 The MathWorks, Inc.
%CHECKFIS Checks the fuzzy inference system properties for legal values.
%
% res = CHECKFIS(FIS) returns 1 if all properties have legal values else it
% throws an error.
%
for i =1:1:length(fis.rule)
if isempty(fis.rule(i).weight)
ermsg = sprintf('weight of rule %d is empty.',i);
error(ermsg);
end
if isempty(fis.rule(i).antecedent)
ermsg = sprintf('antecedent of rule %d is empty.',i);
error(ermsg);
end
if isempty(fis.rule(i).consequent)
ermsg = sprintf('consequent of rule %d is empty.',i);
error(ermsg);
end
if isempty(fis.rule(i).connection)
ermsg = sprintf('connection of rule %d is empty.',i);
error(ermsg);
end
end
for i=1:1:length(fis.input)
if isempty(fis.input(i).name)
ermsg = sprintf('name of input %d is empty.',i);
error(ermsg);
end
if isempty(fis.input(i).range)
ermsg = sprintf('range of input %d is empty.',i);
error(ermsg);
end
end
for i=1:1:length(fis.output)
if isempty(fis.output(i).name)
ermsg = sprintf('name of output %d is empty.',i);
error(ermsg);
end
if isempty(fis.output(i).range)
ermsg = sprintf('range of output %d is empty.',i);
error(ermsg);
end
end
res = 1;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?