How do I convert symbolic values to numerical for uitable ?

3 ビュー (過去 30 日間)
Doug Leaffer
Doug Leaffer 2024 年 12 月 1 日
コメント済み: Walter Roberson 2024 年 12 月 3 日
How do I Convert symbolic values to numerical for uitable ? The table itself, tbl displays fine, but I want to display the same data into a uitable. The last column is symbolic
load datafile.mat
format bank
tbl = table(t',h', round(vpa(v),2)', 'VariableNames',["Time(s)", "Height(ft)","Velocity(ft/s)"])
fig = uifigure;
uit = uitable(fig,"Data",tbl)
  3 件のコメント
Doug Leaffer
Doug Leaffer 2024 年 12 月 3 日
Thank you, however this does not work: uit = uitable(fig, "Data", "ColumnFormat", "bank", tbl)
Error using uitable
Incorrect number of input arguments.
Error in uitable (line 54)
thandle = builtin('uitable', varargin{:});
Error in rocket_analysis_rev_DL (line 37)
uit = uitable(fig, "Data", "ColumnFormat", "bank")
Walter Roberson
Walter Roberson 2024 年 12 月 3 日
uit = uitable(fig, "Data", tbl, "ColumnFormat", "bank")

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

採用された回答

Torsten
Torsten 2024 年 12 月 1 日
syms x
f = x^2-2;
xsol = solve(f==0)
class(xsol)
ans = 'sym'
xvpa = vpa(xsol)
class(xvpa)
ans = 'sym'
xnum = double(xsol)
xnum = 2×1
1.4142 -1.4142
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
class(xnum)
ans = 'double'
  1 件のコメント
Doug Leaffer
Doug Leaffer 2024 年 12 月 3 日
Thank you. Your comments were helpful and this code modification worked fine:
load datafile.mat
format bank
vel = double(v);
tbl = table(t',h', vel', 'VariableNames',["Time(s)", "Height(ft)","Velocity(ft/s)"])
fig = uifigure;
uit = uitable(fig, "Data", tbl)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by