I tried to use this function but it takes only the last point from the step
function [ norepx,norepy ] = norep( xdata,ydata)
n=length(xdata);
j=0;
k=0;
for i=1:n-1
j=j+1;
k=k+1;
if abs(ydata(i)-ydata(i+1))>0
ny(k)=ydata(i);
nx(j)=xdata(i);
end
end
ind=find(nx);
norepx=nx(nx>0);
for i=1:length(ind)
norepy(i)=ny(ind(i));
end
norepx=[xdata(1) norepx xdata(length(xdata))];
norepy=[ydata(1) norepy ydata(length(ydata))];
norepx(2)=[]; norepy(2)=[];
end