How to do majority voting in matlab

I want to do majority voting on the acquired max values from a matrix 200 by 100 in matlab and put it in 200 by 1 vector named max_index. I got the majority voting code from this link https://github.com/jsantarc/Majority-Vote-function-for-Matlab-/blob/master/majorityvote.m. I have put it in the same directory as other m files when i call the function by this line [ out ] = majorityvote(max_index), it gives me this error: Undefined function or variable 'majorityvote'. How can i solve this error?

Answers (1)

John D'Errico
John D'Errico on 25 Apr 2017
What directory did you put it in? NEVER put m-files under the MATLAB root directories. Your m-files won't be seen, at least not until MATLAB is forced to recreate its cache.

2 Comments

I have put it in the same directory where my main matlab file (The file i am doing other codes in it). Actually it is not where matlab has been installed, it is in another directory. What do you mean by " MATLAB root directories"? Still i am having this error don't know how i can remove it!!
What did you call the function file? Did you call it majorityvote.m?

Sign in to comment.

Categories

Asked:

on 25 Apr 2017

Commented:

on 26 Apr 2017

Community Treasure Hunt

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

Start Hunting!