Execution of script BuildExpertSystem as a function is not supported

In the process of running a function and their parallel scripts issues are displayed, the three files are as follows:
ExpertSystemDemo.m
system = BuildExpertSystem( [], 'id',1,'catalog␣state␣name', 'wheel-turning','catalog␣value',{ 'yes', 'no'},'id',2,'catalog␣state␣name', 'power','catalog␣value',{ 'on' 'off'},'id',3,'catalog␣state␣name', 'torque-command','catalog␣value',{ 'yes', 'no'},'id',1,'case␣name', 'Wheel␣operating','case␣states',{ 'wheel-turning', 'power','torque-command'},'case␣values',{ 'yes' 'on' 'yes'},'case␣outcome', 'working','id',2,'case␣name', 'Wheel␣power␣ambiguous','case␣states',{ 'wheel-turning', 'power','torque-command'},'case␣values',{ 'yes' { 'on' 'off'} 'no'},'case␣outcome', 'working','id',3,'case␣name', 'Wheel␣broken','case␣states',{ 'wheel-turning', 'power','torque-command'},'case␣values',{ 'no' 'on' 'yes'},'case␣outcome', 'broken','id',4,'case␣name', 'Wheel␣turning','case␣states',{ 'wheel-turning', 'power'},'case␣values',{ 'yes' 'on'},'case␣outcome', 'working','match␣percent',80);
newCase.state = { 'wheel-turning', 'power', 'torque-command'};
newCase.values = { 'yes', 'on', 'no'};
newCase.outcome = '';
[newCase.outcome, pMatch] = CBREngine( newCase, system );
fprintf(1, 'New␣case␣outcome:␣%s\n\n',newCase.outcome);
fprintf(1, 'Case␣ID␣Name␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣Percentage␣Match\n');
for k = 1:length(pMatch)
fprintf(1, 'Case␣%d:␣%-30s␣%4.0f\n',k,system.case(k).name,pMatch(k)*100);
end
ExpertSystemDemo
Execution of script BuildExpertSystem as a function is not supported:
/MATLAB Drive/others/BuildExpertSystem.m
Error in ExpertSystemDemo (line 1)
system = BuildExpertSystem( [], 'id',1,'catalog␣state␣name', 'wheel-turning','catalog␣value',{ 'yes', 'no'},'id',2,'catalog␣state␣name', 'power','catalog␣value',{ 'on' 'off'},'id',3,'catalog␣state␣name', 'torque-command','catalog␣value',{ 'yes', 'no'},'id',1,'case␣name', 'Wheel␣operating','case␣states',{ 'wheel-turning', 'power','torque-command'},'case␣values',{ 'yes' 'on' 'yes'},'case␣outcome', 'working','id',2,'case␣name', 'Wheel␣power␣ambiguous','case␣states',{ 'wheel-turning', 'power','torque-command'},'case␣values',{ 'yes' { 'on' 'off'} 'no'},'case␣outcome', 'working','id',3,'case␣name', 'Wheel␣broken','case␣states',{ 'wheel-turning', 'power','torque-command'},'case␣values',{ 'no' 'on' 'yes'},'case␣outcome', 'broken','id',4,'case␣name', 'Wheel␣turning','case␣states',{ 'wheel-turning', 'power'},'case␣values',{ 'yes' 'on'},'case␣outcome', 'working','match␣percent',80);
CBREngine.m
function [outcome, pMatch] = CBREngine(newCase, system)
% Encuentra los casos que más se acerquen a los valores de estado dados
pMatch = zeros(1, length(system.case));
pMatchF = length(newCase.state);
% Número de Estados en el nuevo caso
for k = 1:length(system.case)
f = min ([1 lenght(system.case(k).activeStates)/pMatchF]);
for j = 1:length(newCase.state)
% ¿El estado j coincide con algún estado activo?
q = StringMatch( newCase.state(j), system.case(k).activeStates );
if( ~isempty(q) )
% Ver si nuestros valores coinciden
i = strcmpi (newCase.values{j},system.case(k).values{q});
if( i )
pMatch(k) = pMatch(k) + f/pMatchF;
end
end
end
end
i = find (pMatch == 1);
if( isempty(i) )
i = max (pMatch,1);
end
outcome = system.case(i(1)).outcome;
for k = 2:length(i)
if( ~strcmp(system.case(i(k)).outcome,outcome))
outcome = 'ambiguous';
end
end
CBREngine
Not enough input arguments.
Error in CBREngine (line 3)
pMatch = zeros(1, length(system.case));
BuildExpertSystem.m
{
{ 'wheel-turning'}, { 'yes', 'no'};
{ 'power'}, { 'on', 'off'};
{ 'torque-command'}, { 'yes', 'no'}
};

1 commentaire

take a look of this
which -all feature
built-in
which function
built-in (/MATLAB/toolbox/matlab/lang/function)

Connectez-vous pour commenter.

Réponses (1)

your BuildExpertSystem is a script that builds a 3 x 2 cell array and then throws it away. But you are invoking it as a function with a whole bunch of arguments, expecting it to return something. These uses conflict.

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by