Error using FuzzyInfer​enceSystem​/addInput Expected a string scalar or character vector for the parameter name.

I have this error, and i dont know why. : Error using FuzzyInferenceSystem/addInput
Expected a string scalar or character vector for the
parameter name.
Error in FLCGauss (line 9)
fis = addInput(fis, 'Desplazamiento', [-1 1]);
THIS IS MY CODE:
% Crear objeto FIS vacío
fis = mamfis('Name','myfis','NumInputs',2,'NumOutputs',1);
fis.AndMethod = 'prod';
fis.OrMethod = 'max';
fis.ImplicationMethod = 'min';
fis.AggregationMethod = 'max';
% Agregar variable de entrada 'Desplazamiento'
fis = addInput(fis, 'Desplazamiento', [-1 1]);
Error using FuzzyInferenceSystem/addInput
Expected a string scalar or character vector for the parameter name.
fis = addMF(fis, 'Desplazamiento', 'mf1', 'gaussmf', [ddesvest1 dmedia1]);
fis = addMF(fis, 'Desplazamiento', 'mf2', 'gaussmf', [ddesvest2 dmedia2]);
fis = addMF(fis, 'Desplazamiento', 'mf3', 'gaussmf', [ddesvest3 dmedia3]);
fis = addMF(fis, 'Desplazamiento', 'mf4', 'gaussmf', [ddesvest4 dmedia4]);
fis = addMF(fis, 'Desplazamiento', 'mf5', 'gaussmf', [ddesvest5 dmedia5]);
fis = addMF(fis, 'Desplazamiento', 'mf6', 'gaussmf', [ddesvest6 dmedia6]);
fis = addMF(fis, 'Desplazamiento', 'mf7', 'gaussmf', [ddesvest7 dmedia7]);

 Réponse acceptée

It is not possible to add a sub-section to a FIS. You cannot create variable names such as myfis -> Desplazamiento -> mf1 or myfis.Desplazamiento.mf1 or myfis/Desplazamiento/mf1 : you can only have variables directly under the FIS.
You need to remove the 'Desplazamiento', from all of those calls.

3 commentaires

Thank you for your answer,
But now I have this problem:
Error using FuzzyInferenceSystem/addMF
Input variable "mf1" does not exist. What do you think I need to do?
% Agregar variable de entrada 'Desplazamiento'
fis = addInput(fis, [-1 1]);
fis = addMF(fis,'mf1', 'gaussmf', [ddesvest1 dmedia1]);
fis = addMF(fis, 'mf2', 'gaussmf', [ddesvest2 dmedia2]);
fis = addMF(fis, 'mf3', 'gaussmf', [ddesvest3 dmedia3]);
fis = addMF(fis,'mf4', 'gaussmf', [ddesvest4 dmedia4]);
fis = addMF(fis,'mf5', 'gaussmf', [ddesvest5 dmedia5]);
fis = addMF(fis,'mf6', 'gaussmf', [ddesvest6 dmedia6]);
fis = addMF(fis, 'mf7', 'gaussmf', [ddesvest7 dmedia7]);
fis = addInput(fis, [-1 1], 'Name', 'mf1');
and likewise for the other mf* variables.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Fuzzy Logic in Simulink 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