Using Weka in Matlab

Version 1.5 (5.43 MB) by Sunghoon Lee
An efficient interface to use Weka in MATLAB
Updated 22 Jul 2015

View License

Weka is an open-source platform providing various machine learning algorithms for data mining tasks. Although Weka provides fantastic graphical user interfaces (GUI), sometimes I wished I had more flexibility in programming Weka. For instance, I often needed to perform the analysis based on leave-one-out-subject cross-validation, but it was quite difficult to do this on Weka GUI. I do most of my analyses on MATLAB, so I was searching for an interface between MATLAB and Weka. Fortunately, Weka was implemented in Java, and MATLAB had a wrapper that allows communicating with Java.
Here I introduce an efficient MATLAB to Weka interface, which was implemented based on the initial work of Matt Dunham.
This work is still in-progress and I have only included codes that I mainly use for my work. If you would like to collaborate to improve the code or if you find any bugs, please don't hesitate to reach me at "silee {at} partners {dot} org".
Also, please visit

Cite As

Sunghoon Lee (2024). Using Weka in Matlab (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Statistics and Machine Learning Toolbox in Help Center and MATLAB Answers

Inspired by: Matlab Weka Interface

Inspired: Truss displacement based on FEM

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes

Small duplicated lines of code have been removed. Minor changes!
1. Paths to WEKA has been updated to comply with Mac users. Thanks to Giovanni Mascia.
2. The "crossvalind" function, which requires the Bioinformatics toolbox, is replaced with idxCV = ceil(rand([1 N])*K)+1;. Thanks to Igor Varfolomeev

The input files for example codes have been added since some older versions of MATLAB don't have them built in.
The classifier & cost-sensitive classifier now produces "nominal outputs" rather than "numerical outputs". Thanks to Giovanni Mascia!

There was a small bug in wekaRegression.m and regression_example.m, which is "now" fixed.

There was a small bug in wekaRegression.m and regression_example.m, which is not fixed.

Correction: Bioinformatics Toolbox is not required!