How to solve the error: 'Input data must have as many columns as input variables and as many rows as independent sets of input values.'

조회 수: 9 (최근 30일)
Hello! I created HTML-built UI and embedded it to matlab. I am able to pass the user-inputed data from the UI to matlab. My problem now is whenever I insert those data to my anfis model, it was generating this error
my riskFis is expected to receive 19 inputs and 5 inputs for typeFis, I already counted my inputs and they're of correct number. I tried changing my riskinputs to 19 constant number and the error is gone. But when i tried putting one input from the user-inputted data (the rest constant number), the error is back again. This is the code
% Data changed function: Assessment
function AssessmentDataChanged(app, event)
data = event.Data;
rfis = readfis('riskFis');
tfis = readfis('typeFis');
riskInput = [data.Age 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
riskOutput = evalfis(rfis, double(riskInput));
typeInput = [data.Age data.Temp data.Cough data.Hospital data.Ventilator];
typeOutput = evalfis(tfis, double(typeInput));
disp(riskOutput)
disp(typeOutput)
end
There is also no problem when i input user inputted data from the ui built with web app designer. So i think the problem is the data coming from the html built UI, but i dont know how to solve it.

채택된 답변

Jovelyn Obias
Jovelyn Obias 2021년 11월 16일
이동: Sam Chak 2025년 4월 22일
Already found the answer. double is casting my inputs to ascii. it should be str2double, and the [] should be {}.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by