1

There is a Matlab function (h5write) that lets the user write output files in hdf5 format. This seems to work nicely when using the Matlab environment and Matlab files. However, when I try to generate C++ code out of the Matlab files, a conversion error arises. It appears that the code generator (Matlab Coder) cannot convert the h5write operation into C++ code.

Is there any way of getting around this issue? Efficiency is also important here since the data sets that need to be stored by the generated C++ executable are fairly large. If anybody could help me out here, it would make my day! :-)

1 Answer 1

4

MATLAB currently provide an interface for converting the code for h5write into C++ code. That being said, you can use MATLAB compiler to build an executable or dll. You can use this in your C++ code, but you will always need the MCR. If space is not a constraint, you can do this.

Otherwise, you can use the HDF5 API (http://www.hdfgroup.org/HDF5/doc/cpplus_RM/) and write code for writing into HDF5 file format and then use MATLAB Coder to link and compile.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much for your answer! But which interface is that? And do you perhaps know why I get the conversion error at the h5write operation when I try generating the C++ code with the Matlab Coder?
I will answer the second part first. MATLAB Coder hasn't enabled code generation for this function as of the moment. Only this small subset is enabled link. However, if you want support, do contact technical support link, who will forward the request to the developers. To answer the first question, try using one of their examples link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.