MATLAB: Need help debugging an error with Latex Interpreter and sprintf

latex

For some reason I keep getting errors with the interpreter when I try to put in this code:
title(sprintf('Pressure $(1-M_\infty^2)u_{xx}+u_{yy}=0$, $M_\infty=%s$', Minf),'Interpreter','latex')
Anyone have suggestions for the formatting?

Best Answer

You need to use two consecutive \\ in fprintf and sprintf.
This works:
title(sprintf('Pressure $(1-M_\\infty^2)u_{xx}+u_{yy}=0$, $M_\\infty=%s$', Minf),'Interpreter','latex')