Getting case ID for a particular monitor label from an HDF file

The code snippet below will grab a list of all case IDs and module labels in an HDF file. Then it looks for a label corresponding to "Right Wrist" and gets the case ID for that monitor. This case ID can then be used to read the datasets corresponding to that monitor. Error checking for the case where the particular label is not present in the file is omitted for brevity. 


strip = @(x) x(1:min([find(x == 0, 1, 'first')-1, length(x)]));
caseIds = cellfun(strip, h5readatt('sensor_data.h5', '/', 'CaseIdList'), 'UniformOutput', false)
labelList = cellfun(strip,h5readatt('sensor_data.h5', '/', 'MonitorLabelList'), 'UniformOutput', false);
rWristId = caseList{strcmp(labelList, 'Right Wrist')};

Have more questions? Submit a request


Article is closed for comments.