Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0
(1,535 bytes)
function [ c ] = pnNumRecordings(data, featStr)
%PNNUMRECORDINGS calculate various stats on the time stamps in the data
% [ c ] = pnNumRecordings(data) calculates the number of recordings for
% the given feature.
%
% Inputs:
% data - Cell array of data.
% Column 1 - Subject IDs
% Column 2 - Time stamp vectors for each subject
% Column 3 - Feature name vectors for each subject
% Column 4 - Data value vectors for each subject
%
% featStr - String of single field used to extract features
%
% Outputs:
% c - A cell of the same size as data in standard format (above)
% There exist multiple feature labels in Column 3.
%
%
% Example
% bpath = './set-a/';
% data = pnLoadTextFilesCell(bpath);
% c = pnNumRecordings(data(1,:)) %
% See also PNGENERATEFEATURES
% References:
% Physionet Challenge 2012
% Copyright 2012 Alistair Johnson
% $LastChangedBy: alistair $
% $LastChangedDate: 2012-06-18 10:41:11 -0400 (Mon, 18 Jun 2012) $
% $Revision: 98 $
% Originally written on GLNXA64 by Alistair Johnson, 11-May-2012 09:12:20
% Contact: alistairewj@gmail.com
N = size(data,1);
c = cell(N,4);
c(:,1) = data(:,1);
%=== First, get number of recordings
c(:,4) = cellfun(@(x) numel(x), data(:,2),'UniformOutput',false);
idxExist = cellfun(@(x) ~isempty(x), c(:,4));
Nexist = sum(idxExist);
%=== Handle feature labels
featStrCell = {[featStr,'NumRecordings']}; % create feature label
c(idxExist,3) = repmat({featStrCell},Nexist,1);
%=== Time stamps
c(idxExist,2) = repmat({0},Nexist,1);
end