Convert some columns in 'double array' to single digit, rest as bank and then put in UITable

1 view (last 30 days)
Hello, I have an array (class='double)
T =
1.0000 1.0000 1.0000 1.3521 0.1780 0 1.3966 10.0000
2.0000 1.0000 2.0000 0.9910 0.1720 0 1.4454 10.0000
3.0000 1.0000 3.0000 1.1243 0.1800 0 1.4053 10.0000
4.0000 1.0000 4.0000 1.0776 0.1750 0 1.3999 10.0000
5.0000 1.0000 5.0000 1.0350 0.1770 0 1.3809 10.0000
6.0000 1.0000 6.0000 0.9700 0.1750 0 1.4079 10.0000
7.0000 1.0000 7.0000 0.9111 0.1730 0 1.4379 10.0000
8.0000 1.0000 8.0000 1.1395 0.5280 0 1.4052 10.0000
9.0000 1.0000 9.0000 1.0037 0.1750 0 1.3662 10.0000
I want to insert this into a UITable but have column 1,2 & 3 with no decimals.
So I have tred this
T=app.Timings % My data
class(T) % 'double'
C1=num2str(T(:,1),'%.0f');
C2=num2str(T(:,2),'%.0f');
T(:,1)=C1(:,1)
T(:,2)=C2(:,1)
app.UITable2.Data=T;
T2=app.UITable2;
T2.ColumnFormat = {'char' 'char' 'char' 'bank' 'bank' 'bank' 'bank' 'bank'};
%app.UITable2.DisplayData
But Im getting weird results

Accepted Answer

Jason
Jason on 25 Jan 2021
I found this works:
C = num2cell(T)
app.UITable2.Data=C;
app.UITable2.ColumnFormat={'char','char','char','bank','bank','bank','bank','bank'};

More Answers (1)

Mario Malic
Mario Malic on 21 Jan 2021
Hello,
Issue in your code is on this line. You asked for the number with 0 decimals, replace 0 with how many decimals you want there to be and it should be working.
C1=num2str(T(:,1),'%.0f');

Categories

Find more on Filter Banks in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!