Search code examples
matlabmachine-learningweka

mat file to weka file


I am trying to use weka but it cannot. I have a .mat file that I generated in MATLAB and tried to convert it to WEKA format.

Things that I tried:

  1. .mat to .xml (to use it in WEKA experimenter part) to do that I used the following code in here and WEKA gives error and says that "couldn't open experiment file"

  2. tried to convert it as .arff file to use in WEKA explorer and followed the instructions here

But I have no idea about what classes and relation means in the code. I also couldn't find it on the internet. What are these two values meaning?

Best,

[ success_value ] = mat2arff( mat_filename, arff_filename, relation, classes )

Solution

  • You do not need an external function such as 'mat2arff'. Weka can read *.csv files, so you can use csvwrite. So, Assuming your mat file name is Matlab.mat and it contains a variable named test, you can do this:

    >> load Matlab.mat
    >> csvwrite('yourCSVfile.csv', test);