
James C. Sutherland
On Mon, Oct 25, 2010 at 3:27 PM, Daniel Herring
wrote:Isn't matlab capable of reading hdf5 files? That might be a reasonable target for boost::serialization.
This was discussed briefly on the ublas list. Someone also told us that boost::serialization is really not meant for proprietary file formats.
endeavor.It is probably a better idea to build a MEX interface where the C++ classes are loaded natively and exported to Matlab.James
One approach is to wrap the MATIO library (which means the MEX wrappers is not necessary). I wrote upa mediocre and temporary version for loading/saving. Right now it only supports double values (and probably only compiles on win32) but you can see the coding approach and hack up the code at will. //////////////////////// The code looks like the following: matlab_iostream arch(boost::filesystem::path("...path...")); ublas::matrix<double> x_1(2,2); x_1 <<= 1.1, 2.1, 3.1, 4.1; arch << named("x_1_matlab", x_1); //Stores in the name "x_1_matlab" in matalb ublas::vector<double> x_2; arch >> named("x_1_matlab", x_2); //Loads from the archive into vector ///////////////////////////////// Here are a few links for the implementation (which supports ublas vectors, scalars, ublas matrices, and boost::multi_array): http://econtoolkit.com/browser/libraries/trunk/etk/etk/serialization/named_v... ble.hpp http://econtoolkit.com/browser/libraries/trunk/etk/etk/serialization/matlab/... ab_iostream.hpp http://econtoolkit.com/browser/libraries/trunk/etk/etk/serialization/matlab/... ix.hpp http://econtoolkit.com/browser/libraries/trunk/etk/etk/serialization/matlab/... ar.hpp http://econtoolkit.com/browser/libraries/trunk/etk/etk/serialization/matlab/... or.hpp The test suite is in: http://econtoolkit.com/browser/libraries/trunk/etk/tests/serialization/matla... st_matlab_archive.cpp http://econtoolkit.com/browser/libraries/trunk/etk/tests/serialization/matla... st_matlab_matrix.cpp http://econtoolkit.com/browser/libraries/trunk/etk/tests/serialization/matla... st_matlab_vector.cpp http://econtoolkit.com/browser/libraries/trunk/etk/tests/serialization/matla... st_matlab_multi_array.cpp http://econtoolkit.com/browser/libraries/trunk/etk/tests/serialization/matla... st_matlab_scalar.cpp -Jesse