function [Ld_inpn, Ld_inph, Ld_inpu] = linput(Ld)

%% NORMAL, horizontal, friction CARTAO
%%Extract steps 
for HH=1:3:27
    
   Mn=(min(Ld(:,HH)))+250;
a=1; x=-1; j=1; z=0; b=0; indzero=(find(Ld(a:end,HH)<Mn & Ld(a:end,HH)>200))'; a1=indzero(1);
for g=1:1:14
    while x==-1
        x=indzero(1,j)-indzero(1,j+1); j=j+1; z=z+1; %n de zeros (pontos - pé no ar)
    end
    y=indzero(1,j-1)-indzero(1,j); a=a1+b+z; c=a-y-1;
    if g ~=1 %step index
        I(HH,g)=a+1; %start step
        F(HH,g)=c; %end step
    end
    b=c; z=0; x=-1; a1=0;
end
end

%%Remove zeros
for HH=1:3:27
bb=1;
for hhh=1:1:size(I,2)
    if F(HH,hhh)-I(HH,hhh) > 70 
        II(HH,bb) = I(HH,hhh); FF(HH,bb) = F(HH,hhh); bb=bb+1;    
    end
end
end

%%check 'steps' lenght left
for HH=1:3:27
jg=size(FF,2);
for kh=1:1:jg;
gj(HH,kh)=FF(HH,kh)-II(HH,kh);
end
end

%T
yy=1;
for HH=1:3:27
for xx=1:1:size(II,2);
    if((FF(HH,xx)-II(HH,xx))>0)
    Ld_inpn{yy}=Ld(II(HH,xx):FF(HH,xx),HH);
    yy=yy+1;
    end
end
end

%H
yy=1;
for HH=1:3:27
for xx=1:1:size(II,2);
    if((FF(HH,xx)-II(HH,xx))>0)
    Ld_inph{yy}=Ld(II(HH,xx):FF(HH,xx),HH+1);
    yy=yy+1;
    end
end
end

%H/T
yy=1;
for HH=1:3:27
for xx=1:1:size(II,2);
    if((FF(HH,xx)-II(HH,xx))>0)
    Ld_inpu{yy}=Ld(II(HH,xx):FF(HH,xx),HH+2);
    yy=yy+1;
    end
end
end

%% Pad

% AUX=max(cellfun('size',Ld_inpn,1)); %- min(cellfun('size',Cd_inpu,1));
% for HH=1:1:size(Ld_inpn,2)
%     Ld_inpn{HH}=padarray(Ld_inpn{HH},(AUX-size(Ld_inpn{HH},1)),0,'post');
%     Ld_inph{HH}=padarray(Ld_inph{HH},(AUX-size(Ld_inph{HH},1)),0,'post');
%     Ld_inpu{HH}=padarray(Ld_inpu{HH},(AUX-size(Ld_inpu{HH},1)),0,'post');
% end