I create a matlab duration object and save it to a .mat file:
<code>timeend = seconds(123);
save('time.mat', timeend, '-v7.3');
</code>
<code>timeend = seconds(123);
save('time.mat', timeend, '-v7.3');
</code>
timeend = seconds(123);
save('time.mat', timeend, '-v7.3');
Then I read it from python:
<code>with h5py.File('time.mat', 'r') as f:
var = f['timeend'][:]
print(list(var))
</code>
<code>with h5py.File('time.mat', 'r') as f:
var = f['timeend'][:]
print(list(var))
</code>
with h5py.File('time.mat', 'r') as f:
var = f['timeend'][:]
print(list(var))
Then var
is a np object:
<code>[array([3707764736, 2, 1, 1, 1,
1], dtype=uint32)]
</code>
<code>[array([3707764736, 2, 1, 1, 1,
1], dtype=uint32)]
</code>
[array([3707764736, 2, 1, 1, 1,
1], dtype=uint32)]
How to convert this numpy array to a timedelta object or an np.array of the time in seconds?