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?

回答(1 个)

John D'Errico
John D'Errico 2017-4-25
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 个评论

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?

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息

提问:

2017-4-25

Community Treasure Hunt

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

Start Hunting!

Translated by