Hello all, I am having a bit of trouble trying to implement this system in the figure to first have a binary signal go through a channel (which i've done) I then don't know what to do to get the new signal back to binary and how to do the training and decision directed parts. I am struggling to write the code in matlab to implement this.
I have the LMS function :

function [y,e,c] = lms2(x,d,N,mu)
M = max(size(x));
y = zeros(1,M);
e = zeros(1,M);
w = zeros(1,N);  % initialise weight vector
for n = N:M;
    xN = x(n:-1:n-(N-1));
    y(n) = w * xN';
    e(n) = d(n) - y(n);
    w = w + mu * e(n) * xN;
c = w;
Any help is appreciated, thank you.