load .mat file in simulink from python hdf5storage library?
I am trying to load/read some random data in simulink I created using the Python module `hdf5storage`.
I created `.mat` file in Python (simulink supports version 7.3 only) using this code:
# get code on https://pypi.python.org/pypi/hdf5storage/0.1.3
import hdf5storage
import numpy as np
matcontent = {}
matcontent[u'some_numbers'] = np.array([10, 50, 20]) # each key must be a unicode string
hdf5storage.write(matcontent, '.', 'data.mat', matlab_compatible=True)
I can load the written file in matlab but not in simulink giving the error:
> Caused by:
>
> Simulink does not support loading the input data in the variable 'bar'
> in file 'C:\\......\\6D\\data.mat'. The From File block can only load
> MATLAB timeseries objects, structures of MATLAB timeseries objects,
> or two-dimensional arrays consisting of one-dimensional, double,
> non-complex samples.
It says I have to create timeseries objects but how to create it in python?
I'm not sure how you'd do this directly in python, but since you're trying to process the data in matlab anyway, I think this should just be a couple lines of matlab code.