Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8003551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:40:37+00:00 2026-06-04T16:40:37+00:00

I am working on a project thumb recognition. following is code I am reading

  • 0

I am working on a project thumb recognition. following is code I am reading the 118 images of order 42 X 25 and storing them in training matrix.

training=zeros(118, 1050);

imagefiles = dir('*.png');      
nfiles = length(imagefiles);    
for ii=1:nfiles
    currentfilename = imagefiles(ii).name;
    I = imread(currentfilename);

    BW=im2bw(I,graythresh(I));    

    temp = reshape(BW,1,1050);
    training(ii,:)=temp;
end

Now I am creating a matrix of labelData to assign labels to images.

labelData = zeros(118,1);
labelData(1:50,:) = 0; 
labelData(51:83,:) = 1;
labelData(84:118,:) = 2;

Here i am training my system by giving training data and label data.

options=optimset('MaxIter',5000);
SVMStruct =  svmtrain(training,labelData,'Kernel_Function','linear','QuadProg_Opts',options);

BUT when I run this code it is giving me an error like

Error 1 : SVMTRAIN only supports classification into two groups. GROUP contains 3 groups.
Error 2 : SVMStruct = svmtrain(training,labelData,'Kernel_Function','linear','QuadProg_Opts',options);

Kindly help me what is the problem I used it before it was working fine but now I dont know what is going on. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:40:39+00:00Added an answer on June 4, 2026 at 4:40 pm

    Error 1 tells you what the problem is – the MATLAB built-in SVM only supports binary classification. You are assigning 3 classes.

    Your options are:

    1. Construct three classifiers: 0 vs. 1,2 then 1 vs. 0,2 then 2 vs. 0,1 and look at the output of each.
    2. Construct 0 vs. not 0 and then 1 vs. 2
    3. Use a multi-class SVM trainer from LIBSVM or svmlight or other such packages.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a working project. After rearranging some code, I tried to recompile my
While working a project tonight, I ended up using one .js resource file for
I working on project and have problem with threading and update of UI. I
I'm working on project that lets users choose some scientific authors and columnists and
I am working a project with many NUnit tests, that were already written long
I am working on project -online file management where we have to tore file
I'm working on project involving c programming for my mathematics course at university. I
I am working on project in JSF, using Tomcat 7. The application will have
I am currently working on Project Euler for fun, and use Haskell for practicing.
I have a fully working Setup project within Visual Studio 2008 that takes inputs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.