function outdata=port_select(indata)
len=length(indata);
for m=1:(len/8)
    for n=1:(8-1)
        outdata1((m-1)*(8-1)+n)=indata((m-1)*8+n);
    end
end
for m=1:(8-1)
    outdata(m)=indata(1)-(indata(8-(m-1))-indata(1));
end
outdata(8:len/8*7)=outdata1(1:(len/8*7-7));