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

조회 수: 2 (최근 30일)
li
li 2016년 2월 27일
댓글: Star Strider 2016년 2월 27일
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)

채택된 답변

Star Strider
Star Strider 2016년 2월 27일
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
li
li 2016년 2월 27일
Yes, you are genius. Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Bartlett에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by