The escape character works inside lstlisting environment but not inside \lstinline
\documentclass[aspectratio=169, xcolor={x11names}, t]{beamer}
\usetheme{Dresden}
\usefonttheme{professionalfonts}
\renewcommand{\sfdefault}{ppl}
\usepackage[T1]{fontenc}
\renewcommand{\encodingdefault}{T1}
\usepackage{listings}
\usepackage{matlab-prettifier}
% BEGIN_FOLD
\lstdefinestyle{matlab-inline}{
style=Matlab-editor,
basicstyle=\linespread{0.8}\mlttfamily\color{DodgerBlue3},
escapechar=",
}
% END_FOLD
\lstset{style=matlab-inline}
\begin{document}
\begin{frame}[fragile, environment=frame]
\begin{lstlisting}
text "$e = m c^{2}$"
\end{lstlisting}
\lstinline|text "$e = m c^{2}$"|
\end{frame}
\end{document}

