I am having difficulty loading in 'str' variables 'Et' (Endtime) and 'St' (Starttime) from a MATLAB .mat file into Python.
I want identical output as in MATLAB. Instead I have had issues trying to solve this. See below for Python code and output.
# Import numpy and h5py to load in .mat files import numpy as np import h5py
Load in Matlab ('-v7.3') data
fname = 'directory/file.mat' f = h5py.File(fname,'r')
create dictionary for data
All other variables are arrays
<HDF5 dataset "etime": shape (1, 6), type "<u4">
I want to have a string in python equal to the string in MATLAB. In other words, I want print(data["Et"]) = '01011212000000' which is the date and time.
How can I solve this?
Python f-strings are the fastest string formatting option available on Python. It is robust, easy to read, concise and less prone to errors. If you are using Python 3.6+, you must switch to Python f-strings. In this detailed guide, we have covered...
Please see the MATLAB code and equivalent Numpy code below. Question: How can I get the D variable same in Numpy as MATLAB's?
here is the code in python