![]() ![]() ![]() This will crash if the data already exists in the file.This will create the file if it does not already exist.If you know how to add string data, please comment. This will only work on numerical data.% TABLE_TO_HDF5(T, path, group) Saves the table T to the HDF5 file specified by path % TABLE_TO_HDF5(T, path) Saves the table T to the HDF5 file specified by path at the % group, where inputname is the name of the input argument for T % TABLE_TO_HDF5(T) Saves the table T to the HDF5 file inputname.h5 at the root ('/') %TABLE_TO_HDF5 Save a Matlab table in an hdf5 file format ![]() Matlab Helper Function function table_to_hdf5(T, path, group) I've created a simple helper function to convert a Matlab table to a standard hdf5 file, and another helper function in Python to extract the data into a Pandas DataFrame. ![]() However, if you are working with a Matlab table, then IMHO the best solution is to avoid the save option altogether. If you are only reading in basic arrays and structs, see vikrantt's answer on a similar post. X = eng.eval('parameterised_function_in_Matlab(1, 1)', nargout=1)Ī = eng.eval('Structured_variable.object_name') # (nested cell, cell, object) If accessing the disk is slow, maybe loading to memory would help.įurther edit: after much futile searching my final workaround (I really hope someone else has a better solution!) was calling Matlab from python which is pretty easy and fast: eng = _matlab() # first fire up a Matlab instanceĮng = _matlab() # or connect to an existing one Pass this reference to f again: f]Ĭonvert this to a numpy array and extract the value (or, recursively, another : np.array(f]) So starting with (I think the arises from Matlab giving everything to dimensions): f = h5py.File('filename', 'r') Hopefully this partial answer will help someone, and I'd be very happy to see extra pointers. Despite hours of searching I've not found how to access Matlab v7.3 structures either. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |