How to output a decimal format in the use of command Latex?

5 visualizaciones (últimos 30 días)
li
li el 27 de Feb. de 2016
Comentada: Star Strider el 27 de Feb. de 2016
Hi, there? I tried to convert a matrix (calculated by Matlab) to a LaTex format such that I can directly apply it to my LaTex document, I used the _ * Latex*_ command, but the output is not decimal format, how to make its output is in decimal format?
The code and its corresponding output is shown as follows:
W =
0.4237 0.3373 0.2390 0
0.6603 0.3397 0 0
0.6877 0 0 0.3123
0 0 0.6181 0.3819
>> latex_table = latex(sym(W))
latex_table =
\left(\begin{array}{cccc} \frac{4237}{10000} & \frac{3373}{10000} & \frac{239}{1000} & 0\\ \frac{6603}{10000} & \frac{3397}{10000} & 0 & 0\\ \frac{6877}{10000} & 0 & 0 & \frac{3123}{10000}\\ 0 & 0 & \frac{6181}{10000} & \frac{3819}{10000} \end{array}\right)

Respuesta aceptada

Star Strider
Star Strider el 27 de Feb. de 2016
Use the vpa funciton:
latex_table = latex(sym(vpa(W)))
latex_table = \left(\begin{array}{cccc} 0.4237 & 0.3373 & 0.239 & 0\\ 0.6603 & 0.3397 & 0 & 0\\ 0.6877 & 0 & 0 & 0.3123\\ 0 & 0 & 0.6181 & 0.3819 \end{array}\right)
I’m no LaTeX expert, but from my experience, you have to begin and end your LaTeX calls with $.
  6 comentarios
li
li el 27 de Feb. de 2016
Yes, you are genius. Thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by