Appending data to GUI table

392 Views Asked by At

I have program to display data in a uitable:

data_plat = load('Data_Plat.mat');   
Database_All = data_plat.Database_All;   
data2 = table2cell(Database_All(strcmpi(Database_All.Plat, final_output), ...
                                        {'Plat', 'Nama', 'Jurusan', 'Status'}));   
set(handles.uitable1, 'Data', data2); 

final_output is a number computed by the program which always changes because the program is processing video.

How can I invoke this code repeatedly such that data is added to the table without erasing (or replicating) what's already there?

2

There are 2 best solutions below

7
On BEST ANSWER

I believe you're looking for the union function.

Try changing the last line of your code to this:

handles.uitable1.Data = union(handles.uitable1.Data, data2);
2
On

You can simply concatenate the data in the uitable with new data, then update the uitable. Just insert this line before last line of the code in your question:

data2 = [get(handles.uitable1, 'Data'); data2];