5

I am using libsvm in matlab and I am trying to call svmtrain. However I know that Matlab also has a built-in function called svmtrain. I believe they take the same parameters in different order. How do I know which function matlab is calling? I want to call the svmtrain function from libsvm. How can I ensure this will happen?

Shai
  • 111,146
  • 38
  • 238
  • 371
user2604504
  • 697
  • 2
  • 14
  • 29
  • 1
    To ensure that you are calling `svmtrain` from `libsvm`, just add the path to `libsvm` to the top of MATLAB search paths alongwith its sub-directories in case `svmtrain` in not in the main directory - `addpath(genpath(LIBSVM_PATH))` Some info about adding paths is [here](http://stackoverflow.com/questions/22013875/access-m-files-in-a-subfolder-without-permanently-adding-it-to-the-path) – Divakar Apr 22 '14 at 08:57

1 Answers1

2

If you have two functions with the same name, Matlab will call the one that is located closer to the head of your PATH. So, it might be the case that if you call svmtrain from different directories you'll end up calling different functions even if the only change you have made is changing your current working directory.

To know which function matlab is actually using, call the function which from the command line:

>> which svmtrain
Shai
  • 111,146
  • 38
  • 238
  • 371