Update App Designer UITable State

5 次查看(过去 30 天)
GDelga
GDelga 2020-4-30
Hi, I have this table created in AppDesigner:
% Create UITable
app.UITable = uitable(app.GridLayout4);
app.UITable.ColumnName = {'Date'; 'Front Car'; 'Back Car'; 'Front Truck'; 'Back Truck'; 'Front Motorbike'; 'Back Motorbike'; 'Front Bus'; 'Back Bus'};
app.UITable.RowName = {};
app.UITable.Layout.Row = 1;
app.UITable.Layout.Column = 2;
Then when user press a button, load data in the table:
app.UITable.ColumnName = {"Date"};
for i=1:length(fields)
app.UITable.ColumnName{end+1} = channelInfo.FieldDescriptions{fields(i)};
end
r = horzcat(string(timestamps), string(data));
total = ["TOTAL", string(sum(data))];
r = vertcat(r,total);
set(app.UITable,'Data',cellstr(r));
drawnow;
Table properties change, but are not visible in view. The same thing happens to me with a graph, it loads the data, but it is not seen. What can I do?

回答(1 个)

Kanishk Singhal
Kanishk Singhal 2023-7-13
You have to put this in your button pushed callback function.
ButtonPushedFcn is the callback function for a button which is executed whenever you push the button.
You can add your second block of code in a function and add the function in callback of button using inline function.

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by