MATLAB Answers


Error using newrb and newgrnn

Asked by FIR
on 7 Jan 2013
I have a code for svm for classifying 
load fisheriris
xdata = meas(51:end,3:4);
group = species(51:end);
svmStruct = svmtrain(xdata,group,'showplot',true);
same way i tried using newrb and newgrnn
net = newgrnn(xdata,group)
??? Error using ==> cat
CAT arguments dimensions are not consistent.
Error in ==> cell2mat at 89
            m{n} = cat(1,c{:,n});
Error in ==> newgrnn at 70
if isa(t,'cell'), t = cell2mat(t); end

please tell how to fix it

syntax for those says, data and target class,but why i get error



No products are associated with this question.

1 Answer

Answer by Greg Heath
on 7 Jan 2013
 Accepted answer

help grnn

doc grnn

explain the required type and orientation of the input and target data


shows both the type and orientation of your data



without the semicolons allows you to "see" the data.

With the above info you should be able to readily debug your code.

Hope this helps.

Thank you for formally accepting my answer.



on 7 Jan 2013
I tried with this small code ,
T=[0 0  1  1 1];
net = newgrnn(P,T)
y = sim(net,K);
y gives 1 as output,plz tell what it indicates
Greg Heath
on 7 Jan 2013

You created the net to output 0 when either of the first two P columns are used as input and to output 1 when one of the last three columns of P are used as input.

Have you folloed up on my previous advice?

If so are there anymore questions?


on 7 Jan 2013

final question how to find the accuracy

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!