for HGL=1:size(matr1,1)-1, if matr1(HGL,3)~=0; [rF, ~]=find(matr1(1:end-1,2)==matr1(HGL,3),1,'first'); [rL,~]=find(matr1(1:end-1,2)==matr1(rF,3),1,'first');
esPip=100-Data1_8(1,1), rF; while (matr1(rF,3)~=0||matr1(rL,2)~=4&&matr1(rL,3)~=0), [rL,~]=find(matr1(1:end-1,2)==matr1(rF,3),1,'first');
if(matr1(rL,2)==1||matr1(rL,3)~=11); esPip=esPip-Data1_8(matr1(rL,2),1);
else(matr1(rL,3)==11); esPip=esPip-5-1.69-Data1_8(matr1(rL,2),1); end
Pp=matr1(rL,2), esPip, rF=rL; end, Pp; esPip; end, Pp; esPip; end, Pp, esPip,
% While my matr1 data; matr1=[....], as:
[ 1 0 1 2 0 11 3 1 2 4 2 3 4 2 7 5 3 4 6 4 0 6 8 0 6 5 0 7 6 5 8 10 6 8 10 9 9 7 12 9 7 16 10 12 8 10 12 13 10 12 18 11 13 14 12 14 0 12 15 0 13 9 15 13 9 19 13 9 20 14 11 10 14 11 21 15 16 17 16 20 0 16 24 0 17 21 25 17 21 30 18 17 26 19 18 22 19 18 27 20 19 28 20 22 28 20 23 28 21 25 24 21 25 23 21 25 29 22 30 34 23 26 31 24 27 32 24 31 32 25 28 0 25 32 0 25 33 0 26 29 33 26 34 33 ];
Data1_8 as:
Data1_8 =
1.4429
2.6124
8.1451
1.6812
19.4516
9.3560
1.8600
5.5220
9.9950
37.9121
1.6948
2.4444
1.6281
3.0449
17.9635
6.5941
12.4950
5.8677
19.2809
13.9613
4.8550
0.1227
36.4404
31.1208
25.8926
11.0250
33.5342
26.6598
41.2031
6.4419
11.7322
-6.7517
21.8971
60.6538

