Hi Jean,
this is because the function sph2xyx might returns a scalar as well as a matrix. Vectorize should do the job, though.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects