How to resolve the error using evalfis: 'Input data must have as many columns as input variables'

Error using evalfis (line 62)
The first argument should have as many columns as input variables and
as many rows as independent sets of input values.
Error in ODentropy>push_trainimg_Callback (line 698)
Outfis=evalfis(pixarry,fuz);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in ODentropy (line 43)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)ODentropy('push_trainimg_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback

1 Comment

What is size(pixarry) and class(pixarry) ? How many input variables was your fis built for?

Sign in to comment.

Answers (1)

If the number of columns in the input data (N) differs from the number of input variables in the fuzzy system (NfisIn), such error message will be generated.
%% load a fuzzy system
fis = readfis("tipper");
%% input values
Service = (0:10)';
Food = (0:10)';
input1 = [Service]; % one input array
input2 = [Service, Food]; % two-input array
[M, N] = size(input1)
M = 11
N = 1
NfisIn = numel(fis.input)
numIn = 2
%% Test 1: output of the Fuzzy Tipper
Tip = evalfis(fis, input2)
Tip = 11×1
5.0780 5.5375 7.5201 12.2184 14.4585 15.0000 15.5415 17.7816 22.4799 24.4625
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
%% Test 2: output of the Fuzzy Tipper
Tip = evalfis(fis, input1)
Error using fuzzy.internal.utility.evalfis (line 84)
Input data must have as many columns as input variables and as many rows as independent sets of input values.

Error in evalfis (line 98)
[varargout{1:nargout}] = fuzzy.internal.utility.evalfis(varargin{:});

Categories

Asked:

on 26 Sep 2016

Answered:

on 23 Apr 2025

Community Treasure Hunt

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

Start Hunting!