How can I write to HDF5 data set on a Simulink-Realtime target machine?
Afficher commentaires plus anciens
I need to write data into a HDF5 data set on a simulink-realtime target machine. Within the simuink model for my target system I wrote a matlab function with the following code for creation of the hdf5 data set:
coder.cinclude('C:\Program Files\HDF_Group\HDF5\1.10.1\include\hdf5.h');
% declare variable fname (string variable for file name) as a 1-by-32 vector of uint8 without performing an unnecessary initialization
fname = coder.nullcopy(uint8(zeros(1, 32)));
% H5F_ACC_TRUNC = coder.nullcopy(uint8(zeros(1,1)));
% H5Fpublic.h (52): #define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */
H5F_ACC_TRUNC = uint8(2);
% /* Default value for all property list classes */
% #define H5P_DEFAULT (hid_t)0
H5P_DEFAULT = coder.opaque('hid_t','0');
% Call external C/C++ function 'sprintf' and write filename into string
% variable fname
coder.ceval('sprintf', coder.wref(fname), ['file.h5', 0]);
file_id = coder.opaque('hid_t'); %/* file identifier */
status = coder.opaque('herr_t');
%/* Create a new file using default properties. */
file_id = coder.ceval('H5Fcreate', fname, H5F_ACC_TRUNC, H5P_DEFAULT , H5P_DEFAULT);
%/* Terminate access to the file. */
status = coder.ceval('H5Fclose',file_id);
Unfortunately I get the following error when trying to compile:
error LNK2019: Reference to unresolved external symbol "H5Fcreate"
error LNK2019: Reference to unresolved external symbol "H5Fclose"
Presumably I somehow have to link the hdf5 libs, but I could not figure out how to do this.
Can anyone help?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!