associated Legendre functions could be found from Legendre functions according to the following formula
so in MATLAB you can define a function like this
function plm = assocLegendre(l,m)
leg = legendreP(l,x);
legDiff = diff(leg,x,m);
plm = ((-1)^m)*((1 - x^2)^(m/2))*legDiff;
to get associated Legendre functions in symbolic form.