How to resolve the error: the variable fuzout(1,i) cannot save fuzout = evalfis(fis, trainin)
Hello, i’m getting an error in my code:
Unable to perform assignment because the indices on the left side are not compatible with
the size of the right side.
Error in anfisloop (line 6)
[fuzout(1,i),trnRMSE(1,i)] = evaltrainset(T(1,i),trainin,trainou);
my code: the function i’m calling:
this function will create 5 models each one will be in a column in T[].
so T(1,1) is the first model, T(1,2) the second …..
the idea of what i want to do is:
create a variable (here fuzout[]) that will stack in each column the output of a model
and another variable that will stack in each column the RMSE of a model.
function [T,fuzout,trnRMSE] = anfisloop(trainin,trainou,testin,testout,fis)
epoch=5;
for i = 1:epoch
opt=anfisopt(testin,testout,fis,i);
T(1,i) = anfis([trainin trainou],opt);
[fuzout(1,i),trnRMSE(1,i)] = evaltrainset(T(1,i),trainin,trainou);
end
end
the function evaltrainset that the precious function call:
evalfis is a matlab’s function
function [fuzout,trnRMSE] = evaltrainset(fis,trainin,trainout)
fuzout = evalfis(fis,trainin);
trnRMSE = norm(fuzout-trainout)/sqrt(length(fuzout));
end
how i am calling the function :
>> [A,fuzout,trnRMSE]=anfisloop(trainin,trainout,testin,testout,fis)
please help.Hello, i’m getting an error in my code:
Unable to perform assignment because the indices on the left side are not compatible with
the size of the right side.
Error in anfisloop (line 6)
[fuzout(1,i),trnRMSE(1,i)] = evaltrainset(T(1,i),trainin,trainou);
my code: the function i’m calling:
this function will create 5 models each one will be in a column in T[].
so T(1,1) is the first model, T(1,2) the second …..
the idea of what i want to do is:
create a variable (here fuzout[]) that will stack in each column the output of a model
and another variable that will stack in each column the RMSE of a model.
function [T,fuzout,trnRMSE] = anfisloop(trainin,trainou,testin,testout,fis)
epoch=5;
for i = 1:epoch
opt=anfisopt(testin,testout,fis,i);
T(1,i) = anfis([trainin trainou],opt);
[fuzout(1,i),trnRMSE(1,i)] = evaltrainset(T(1,i),trainin,trainou);
end
end
the function evaltrainset that the precious function call:
evalfis is a matlab’s function
function [fuzout,trnRMSE] = evaltrainset(fis,trainin,trainout)
fuzout = evalfis(fis,trainin);
trnRMSE = norm(fuzout-trainout)/sqrt(length(fuzout));
end
how i am calling the function :
>> [A,fuzout,trnRMSE]=anfisloop(trainin,trainout,testin,testout,fis)
please help. Hello, i’m getting an error in my code:
Unable to perform assignment because the indices on the left side are not compatible with
the size of the right side.
Error in anfisloop (line 6)
[fuzout(1,i),trnRMSE(1,i)] = evaltrainset(T(1,i),trainin,trainou);
my code: the function i’m calling:
this function will create 5 models each one will be in a column in T[].
so T(1,1) is the first model, T(1,2) the second …..
the idea of what i want to do is:
create a variable (here fuzout[]) that will stack in each column the output of a model
and another variable that will stack in each column the RMSE of a model.
function [T,fuzout,trnRMSE] = anfisloop(trainin,trainou,testin,testout,fis)
epoch=5;
for i = 1:epoch
opt=anfisopt(testin,testout,fis,i);
T(1,i) = anfis([trainin trainou],opt);
[fuzout(1,i),trnRMSE(1,i)] = evaltrainset(T(1,i),trainin,trainou);
end
end
the function evaltrainset that the precious function call:
evalfis is a matlab’s function
function [fuzout,trnRMSE] = evaltrainset(fis,trainin,trainout)
fuzout = evalfis(fis,trainin);
trnRMSE = norm(fuzout-trainout)/sqrt(length(fuzout));
end
how i am calling the function :
>> [A,fuzout,trnRMSE]=anfisloop(trainin,trainout,testin,testout,fis)
please help. function, functions, matlab, matlab function, code, programming, fuzzy MATLAB Answers — New Questions