Symbolic toolbox expressions in table() not shown as LaTeX in livescrit.

1 回表示 (過去 30 日間)
Javier Ros
Javier Ros 2024 年 10 月 30 日
コメント済み: Javier Ros 2024 年 11 月 5 日
The title says it all.
Symbolic ToolBox expresions are shown as latex, but is I use table to format my output, as in
table(symbol_column_vector,corresponding_duble_columvector)
expresions are shown in plain text.
Thanks

採用された回答

Javier Ros
Javier Ros 2024 年 11 月 4 日
Thanks Walter.
This is a very nice trick!!!
I think we've hit a bug. This code mis behaves (becouse the combination with symbolic expressions), giving an unreal big number of low significant decimals:
syms a b c d real
[[a,a+b,c-d]', vpa([1,2,3.1234]',3)]
While
syms a b c d real
[[a,a+b,c-d]', vpa(round([1,2,3.1234]',3))]
runs just OK.
Thanks a lot!!!.
  3 件のコメント
Walter Roberson
Walter Roberson 2024 年 11 月 4 日
syms a b c d real
disp([[a,a+b,c-d]', vpa(round([1,2,3.1234]',3))])
Javier Ros
Javier Ros 2024 年 11 月 5 日
Thanks Walter,
But still, vpa is not working as expected in a variety of cases .
Using vpa with a matrix of string-s representing the number or char arguments seems to work in every case
syms a b c d real
[[a,a+b,c-d]',vpa(string(round([1,2,3.1234]',3)))]
This behavior of vpa, the need to use such a trick, seems like a bug to me.
Thanks again!.

サインインしてコメントする。

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2024 年 10 月 30 日
Correct. table() is not designed for fancy display formatting.
  2 件のコメント
Javier Ros
Javier Ros 2024 年 10 月 31 日
Yes.
But an altenative should be in place, as long as Live Editor is intended for that. Shouldn't it?
Walter Roberson
Walter Roberson 2024 年 11 月 4 日
Just do
[symbol_column_vector, vpa(corresponding_double_columnvector,NUMBER_OF_DECIMAL_POINTS)]
This will create a symbolic array with columns aligned. It will be displayed with ( ) around it, though.

サインインしてコメントする。

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by