Applying format to values in UITable?

So one of the coefficients is very small (10^-7) and the table shows up to 4 decimal by default. So it ends up showing it as zero. How do I change the format?
%% Fit: 'fit 1'.
[xData, yData] = prepareCurveData( x, y );
% Set up fittype and options.
ft = fittype( 'power2' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.394529740755732 -0.329129191919684 -0.00329985728832149];
% Fit model to data.
[fitresult, ~] = fit( xData, yData, ft, opts );
format short e
data = coeffvalues(fitresult);
app.UITable_11.Data = data;

3 件のコメント

Pelajar UM
Pelajar UM 2021 年 9 月 15 日
For anyone else wondering, you should write it like this:
app.UITable_11.ColumnFormat = {'short e'};
Pelajar UM
Pelajar UM 2021 年 9 月 15 日
Thanks, but as you see this is exactly what I tried first and it didn't work. Writing it like this does the job:
app.UITable_11.ColumnFormat = {'short e'};

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

2021 年 9 月 14 日

コメント済み:

2021 年 9 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by