Predicting Mortality of ICU Patients: The PhysioNet/Computing in Cardiology Challenge 2012 1.0.0
(1,190 bytes)
function [times,values,params]=extract_param_series(tm,category,val)
params={};
times={};
values={};
params_found=0;
saved_values={};
%times=zeros(size(tm));
%values=zeros(size(val));
for ind=1:size(tm,1)
cur_time=tm{ind};
cur_param=category{ind};
cur_val=val(ind);
if size(params,1)>0 && max(strcmp(params,cur_param))~=0
cur_param_ind=find(strcmp(params,cur_param));
saved_values{cur_param_ind}=saved_values{cur_param_ind}+1;
n=saved_values{cur_param_ind};
times{cur_param_ind}(n)=str2time(cur_time);
values{cur_param_ind}(n)=cur_val;
elseif size(params,1)==0 % the very first line
params_found=params_found+1;
params{params_found}=cur_param;
values{1}(1)=cur_val;
times{1}(1)=str2time(cur_time);
saved_values{1}=1;
else % new parameter is found
params_found=params_found+1;
params{params_found}=cur_param;
values{params_found}(1)=cur_val;
times{params_found}(1)=str2time(cur_time);
saved_values{params_found}(1)=1;
end
end
%pause();
end