Error: horzcat CAT arguments dimensions are not consistent. with feedforwardnet and newff

1 view (last 30 days)

My Code Is:

A = {MinF; MaxF; MeanF; ModeF; MedianF; SDF; EnergyF; KurtosisF; SkewnessF; EntropyF; VarianceF; ZCRF; MeanPowerF; SNRF; CoVF};
X = cell2mat(A);  
B = {MinS; MaxS; MeanS; ModeS; MedianS; SDS; EnergyS; KurtosisS; SkewnessS; EntropyS; VarianceS; ZCRS; MeanPowerS; SNRS; CoVS};
Y = cell2mat(B);
C = {MinZ; MaxZ; MeanZ; ModeZ; MedianZ; SDZ; EnergyZ; KurtosisZ; SkewnessZ; EntropyZ; VarianceZ; ZCRZ; MeanPowerZ; SNRZ; CoVZ};
Z = cell2mat(C);
P = [X Y Z];
% define targets
T = [repmat(a,1,length(X)) repmat(b,1,length(Y)) ...
     repmat(c,1,length(Z))];
net = feedwordwardnet([P,T,3]);
% train net
net.divideParam.trainRatio = 1; % training set [%]
net.divideParam.valRatio = 0; % validation set [%]
net.divideParam.testRatio = 0; % test set [%]
% train a neural network
[net,tr,Y,E] = train(net,P,T);
% show network
view(net)

It leaves an error message:

??? Error using ==> horzcat
CAT arguments dimensions are not consistent.

I replaced feedforwardnet with newff: but same error message appeared.

I also tried solving this problem with:

net = feedforwardnet(3);
net = train(net,P,T);
view(net)

But it also leads to an error:

??? Undefined function or method 'feedforwardnet' for input arguments
of type 'double'.

How should I complete my Training.. please help?

Thanks in Advance

  1 Comment
per isakson
per isakson on 9 Apr 2017
Edited: per isakson on 9 Apr 2017
  • Do you use the debugging features?
  • Set &nbsp &gt&gt dbstop on error, run your function and inspect the data, which cause the error.
  • Click the Help above the edit-box, in which you write your question.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 9 Apr 2017
feedforwardnet requires the Neutral Network toolbox from R2010b or later.
  3 Comments
JAGRITI SAINI
JAGRITI SAINI on 18 Apr 2017
Thanks a lot For your assistance.. many things are clear now, but can you please help me to know:
as 3 in syntax use to be the hidden layer size. so is it possible to define hidden layer for neural network in a 15x1 matrix format. as far I understand, 3 must be representing the no of hidden neurons for network then what 15x1 matrix will represent?
JAGRITI SAINI
JAGRITI SAINI on 18 Apr 2017
and I am working on R2010a. so I hope i should continue with newff as feedforwardnet is not compatible?

Sign in to comment.

More Answers (1)

Greg Heath
Greg Heath on 9 Apr 2017
lowercase a, b and c used in repmat are undefined.
Hope this helps.
Thank you for formally accepting my answer
Greg

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!