I have a .mat file which could be easily read by matlab, but I need to convert it a C++ readable .model file. is there a way to do it (by hands, or maybe programmatically)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could load the data matrix in MATLAB as any regular MAT-file:
then use the MEX function
libsvmwritewhich comes with the libsvm MATLAB interface, to write it to the so called “sparse” format:If you are talking about trained models not data, a quick search revealed this page (I haven’t personally tested it).
EDIT:
Ok, it appears that the code I mentioned needs some tweaking. Below is my modified version. I tested it using the latest libSVM-3.12, with VS2010 as compiler:
svm_savemodel.c
Assuming you compiled the above MEX file, here is an example usage:
The text file created looks like:
mymodel.model