How to display cell format or table format in GUI table?

2 ビュー (過去 30 日間)
Siti Khadijah Norzafri
Siti Khadijah Norzafri 2020 年 3 月 19 日
Hi Im really in need of help on how to display cell format or table format in GUI table. And I tried using uitable it worked but it does'nt update the data. So I now i just want to know how to display it on the GUI table.
Begining=5000;
YI=0.1; %Yearly Interest
Payment=1000; %Monthly Payment
Data=zeros(1,5); %Data result array
x=1; % x and y are counters
y=1;
while Begining>Payment && Begining>0
%Non Calculated Data
Data(y,x)=Begining; %Saving to Array
x=x+1; %Adding Column Index
Data(y,x)=Payment;
x=x+1;
%Calculations
MI=(Begining*YI)/12; %Monthly Interest
Data(y,x)=MI;
x=x+1;
Principal=Payment-MI; %Principal Payment
Data(y,x)=Principal;
x=x+1;
Ending=Begining-Principal; %Ending Balance
Data(y,x)=Ending;
x=1; %Resetting Column Index
if Payment<=MI
break;
end
Begining=Ending; %Setting New Begining Balance
y=y+1; %Adding Row Index
end
if Payment<=MI
fprintf('Invalid Data, Insuficient Payment');
else
%Final Iteration
Begining=Ending;
Data(y,x)=Begining;
x=x+1;
Data(y,x)=Payment;
x=x+1;
MI=0;
Data(y,x)=MI;
x=x+1;
Principal=Payment;
Data(y,x)=Principal;
x=x+1;
Ending=0;
Data(y,x)=Ending;
x=1;
Data2=num2cell(Data); %Converting into cell
%Converting into Table
Data3=cell2table(Data2,'VariableNames',{'Begining Balance','Payment','Interest','Principal','Ending Balance'});
end

採用された回答

Robert U
Robert U 2020 年 3 月 19 日
Hi Siti Khadijah Norzafri,
apparently uitable() accepts table data:
fh = uifigure;
th = uitable(fh,'Data',Data3);
You can use the property 'Position' to adjust size and position of the table within the figure.
th.Position = th.Position + [0 140 150 -140];
Kind regards,
Robert
  1 件のコメント
Siti Khadijah Norzafri
Siti Khadijah Norzafri 2020 年 3 月 21 日
Thank you so much it worked!!!!!!!!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by