MATLAB Answers

M@lik Ali

Subscripted assignment dimension mismatch.

Asked by M@lik Ali
on 10 Oct 2012

Hi all i am using the fallowing code for the svm classification

svmstruct=svmtrain(PosNegF,group); for l=1:999

                       abc= svmclassify(svmstruct, DB1(l,:)) 
                       Fset(l,:) =[ l,abc];
here DB is the Feature matrix of the 999 images.

Now when first time i execute this code it work fine, but when next time i train the SVM and then run again this code it give the Subscripted assignment dimension mismatch. error. please help me. Thanks in advance


Because, the result or data (svmstruct) will be stored in workspace. To avoid this, you can do with command before this by adding 'clear svmstruct'.

i try clear svmstruct but still the error is same. please help me..

At every iteration of loop svmclassify return 1 or 0 only.

then why it giving the dimension mismatch error. even same for the first time.


No products are associated with this question.

1 Answer

Answer by Matt J
on 10 Oct 2012
Edited by Matt J
on 10 Oct 2012

execute the command dbstop if error at the command line. Then rerun your code. When the error occurs and you get the K>> prompt, check the value/sizes of abc and F.


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!