How to center all of my data in my UItable in Appdesigner
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
i create a table named 'Flowsheet' and i put in im my app
app.UItable2.data = Flowsheet;
the date appears like this 1.47 e+4
- i want to center my data in the mention table
- i want to show my data with out this format , i want the 'format bank'
0 Kommentare
Antworten (1)
Eric Delgado
am 10 Dez. 2022
Try this...
% First issue: transform a numeric value to string, defining your format.
LastName = {'Sanchez';'Johnson';'Li';'Diaz';'Brown'};
Age = [38;43;38;40;49];
Age_string = strsplit(sprintf('%.3f\n', Age), '\n')';
Age_string = Age_string(1:end-1);
T = table(LastName, Age, Age_string)
% Second issue: call uistyle
fig = uifigure;
tab = uitable(fig);
tab.Data = T;
s = uistyle("HorizontalAlignment", "center");
addStyle(tab, s)
2 Kommentare
Eric Delgado
am 11 Dez. 2022
You have to ignore the last element of the conversion...
Age = [38;43;38;40;49]
Age_string = strsplit(sprintf('%.3f\n', Age), '\n')'
% The last element is {''}... ignore it, indexing 1:end-1
Age_string = Age_string(1:end-1)
% In your case...
app.UITable2.Data(:,1) = StreamNumber;
app.UITable2.Data(:,2) = Flow_string(1:end-1);
app.UITable2.Data(:,3) = Flow_kg_string(1:end-1);
app.UITable2.Data(:,4) = D_cons_string(1:end-1);
app.UITable2.Data(:,5) = H2O_string(1:end-1);
app.UITable2.Data(:,6) = H2S_string(1:end-1);
app.UITable2.Data(:,7) = Temperature_string(1:end-1);
app.UITable2.Data(:,8) = Pressure_string(1:end-1);
app.UITable2.Data(:,9) = Molecular_weight_string(1:end-1);
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!