Why do you think this a loadmat
object not having a dictionary? The error is at:
def get_events(matlab_obj):
...
subjects = matlab_obj["s"][0]
...
for subject_object in subjects:
try:
subject_hash = subject_object.my_hashedNumber[0][0] # AttributeError here
matlab_obj["s"]
successfully accesses the loaded object as a dictionary. subjects
is a numpy record array of shape (106,)
, and 58 fields. The correct way to access one of those fields is: subject_object['my_hashedNumber']
.
If the field is multidimensional it should be indexed with [0,0]
, not [0][0]
.
solved scipy.io.loadmat() is not returning dictionary [closed]