Matlab中的Latex函数

use*_*386 3 double matlab latex

我想在Matlab 2013b中使用latex功能.使用此功能很简单,它按我的预期工作:

s = sym('s');
latex((s+1)/3)

ans =

\frac{s}{3} + \frac{1}{3}
Run Code Online (Sandbox Code Playgroud)

比我有一个简单的矩阵和乳胶函数返回以下错误:

A = [ 0 1 0; 1 -2 1; -2 4 -2];
latex(A)
Undefined function 'latex' for input arguments of type 'double'.
Run Code Online (Sandbox Code Playgroud)

另一个例子:

latex(3/4 + 4)
Undefined function 'latex' for input arguments of type 'double'.
Run Code Online (Sandbox Code Playgroud)

在处理符号变量但不适用于整数.哪里可能是问题?

And*_*uri 5

从文档:LaTeX表示符号表达式

做:

latex(sym(A))
latex(sym(3/4+4)) % But this will return the result of the numbers, so \frac{19}{4}
Run Code Online (Sandbox Code Playgroud)