1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| fid = fopen('data.csv', 'r');
X = textscan(fid, '%s%d%s%s%d%d%d%d%d%d%s%d%s%d%d%d%d%s', ...
'delimiter', ';', ...
'headerlines', 1);
fclose(fid);
N=length(X{1});
for n = [11 13 18]
X{n} = strrep(X{n}, '{', '');
X{n} = strrep(X{n}, '}', '');
end
n = 13;
X{n} = cellfun(@(x) strsplit(x, ','), X{n}, 'uniformoutput', false);
for i=1:N
n=13;
R=X{n};
end
for i=1:N
if numel(R{i})~=1
R{i} = cellfun(@(x) strsplit(x, '*'), R{i}, 'uniformoutput', false);
end
end
for i=1:N
if numel(R{i})~=1
if strcmp(R{i}{1}{1},'TC_act_1')==1
a(i)=str2double(R{i}{1}{2})*2*18;
end
if strcmp(R{i}{1}{1},'TC_act_2')==1
a(i)=str2double(R{i}{1}{2})*3*15;
end
if strcmp(R{i}{1}{1},'TC_act_3')==1
a(i)=str2double(R{i}{1}{2})*2*21;
end
if strcmp(R{i}{1}{1},'TC_act_4')==1
a(i)=str2double(R{i}{1}{2})*2*20;
end
if strcmp(R{i}{1}{1},'TC_act_5')==1
a(i)=str2double(R{i}{1}{2})*2*21;
end
if strcmp(R{i}{1}{1},'TC_act_6')==1
a(i)=str2double(R{i}{1}{2})*3*12;
end
if strcmp(R{i}{1}{1},'TC_act_7')==1
a(i)=str2double(R{i}{1}{2})*4*11;
end
if strcmp(R{i}{1}{1},'TC_act_8')==1
a(i)=str2double(R{i}{1}{2})*2*24;
end
if strcmp(R{i}{1}{1},'TC_act_9')==1
a(i)=str2double(R{i}{1}{2})*3*12;
end
if strcmp(R{i}{2}{1},'TC_act_1')==1
b(i)=str2double(R{i}{2}{2})*2*18;
end
if strcmp(R{i}{2}{1},'TC_act_2')==1
b(i)=str2double(R{i}{2}{2})*3*15;
end
if strcmp(R{i}{2}{1},'TC_act_3')==1
b(i)=str2double(R{i}{2}{2})*2*21;
end
if strcmp(R{i}{2}{1},'TC_act_4')==1
b(i)=str2double(R{i}{2}{2})*2*20;
end
if strcmp(R{i}{2}{1},'TC_act_5')==1
b(i)=str2double(R{i}{2}{2})*2*21;
end
if strcmp(R{i}{2}{1},'TC_act_6')==1
b(i)=str2double(R{i}{2}{2})*3*12;
end
if strcmp(R{i}{2}{1},'TC_act_7')==1
b(i)=str2double(R{i}{2}{2})*4*11;
end
if strcmp(R{i}{2}{1},'TC_act_8')==1
b(i)=str2double(R{i}{2}{2})*2*24;
end
if strcmp(R{i}{2}{1},'TC_act_9')==1
b(i)=str2double(R{i}{2}{2})*3*12;
end
else a(i)=0;
b(i)=0;
end
T(i)=a(i)+b(i)+X{numel(X)-1}(i)+X{numel(X)-2}(i)+X{numel(X)-3}(i)+X{numel(X)-4}(i);
end |
Partager