How do I export variables and equations in latex form?

49 visualizaciones (últimos 30 días)
Mark Hard
Mark Hard el 1 de Mzo. de 2017
Respondida: fhz el 10 de Feb. de 2020
Hi all,
I am currently trying to export step by step solutions from my code to be used in nicely formatted lecture notes. From reading around I found that I can export a result from the code using the "latex" command. For example, for the matrix K:
K = [3956.04395604396 -2142.85714285714; -2142.85714285714 7170.32967032967]
I can use
latex(vpa(sym(K),6))
and it gives me code for a nicely formatted matrix which can easily be copied into a tex file.
However, I was to take it a step farther and write unsolved equations in a format similar to this picture.
Again using values calculated using the code.
Could anyone point me in the right direction?
Many thanks!
Mark
  2 comentarios
Stephen23
Stephen23 el 1 de Mzo. de 2017
Editada: Stephen23 el 1 de Mzo. de 2017
@Mark Hard: today I formatted your code for you. Next time you can do it yourself: select the code text and click the {} Code button above the textbox.
I also uploaded the image using the image button: please do not put links to images on other websites (third-party websites change and the links are then totally useless).
Mark Hard
Mark Hard el 1 de Mzo. de 2017
Thanks for that Stephen.

Iniciar sesión para comentar.

Respuestas (1)

fhz
fhz el 10 de Feb. de 2020
Hi Mark Hard.
I've had the same issues you have, then I wrote some code to facilitate the process.
I may indicate for you my Matlab to LaTeX Library and also my File Manipulation Library.
The first has some functions to write LaTeX code from some objects in matlab. The second has funcions to write files from strings in Matlab. So, Matlab to Latex creates strings as you need and File Manipulation creates the files to be used in LaTeX.
Any suggestions are appreciated.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by