First of all sorry for my bad english. I want to convert my matlab figure to a latex code (no graphic). I want the latex code. I know its possible. But i dont know how. Of course i can also export my matlab figure to an eps or pdf! But i need from this matlab figure the latex code. i hope you understand my problem. thank you in advance.


It is highly recommended to use matlab2tikz for this task. You need to download the package and after plotting your figure in Matlab, you should run the matlab2tikz.m function by:


Then you can add YourLatexFile.tex into your LaTeX source code, for example by using \input{YourLatexFile.tex}:


  %% the following commands are sometimes needed
  %% you may also want the following commands
  %\pgfplotsset{plot coordinates/math parser=false}


Also there are suitable documentation and examples in their Github page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.