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

4 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Robert U
Robert U el 19 de Mzo. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by