0

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?

Dev-iL
  • 23,742
  • 7
  • 57
  • 99

2 Answers2

0

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];
Xiangrui Li
  • 2,386
  • 2
  • 13
  • 17
0

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);
Dev-iL
  • 23,742
  • 7
  • 57
  • 99
  • yeah, something like that, but why data just set(show) in 1 column, how to make it show with 1 row every data,? my table have 4 column – Yusran Mansyur Sep 07 '17 at 13:50
  • @YusranMansyur 1) You probably need to transpose (`.'`) it. 2) Delete the 1st row? Please provide actual data if you want help. I can't really help you based on vague descriptions. – Dev-iL Sep 07 '17 at 14:04
  • oh, sorry, my bad, my data just set in 1 column(downward), how to make it show normally,? – Yusran Mansyur Sep 07 '17 at 14:12
  • 2. its starting show data in row number 2, row number 1 is empty – Yusran Mansyur Sep 07 '17 at 14:13
  • No point in asking any further questions unless you're going to add ACTUAL data to your question reproducing the problem. See [mcve]. Good day! – Dev-iL Sep 07 '17 at 14:30
  • u can see picture : https://scontent.fsub2-1.fna.fbcdn.net/v/t34.0-12/21442932_1727051760647332_1464414969_n.png?_nc_eui2=v1%3AAeE3bPqQPzh7fRgOxqTeQbtKbOHaX2q-LZ11hO2LBX2vEzo81h6vUrXOBxw2YekqF2pcE5Pg5-k135HQNBMlQp4J8fB5BrnKJwN998W5XzJt5A&oh=20bdbb0de701eee285b5352f1e4af2aa&oe=59B39816 – Yusran Mansyur Sep 07 '17 at 14:32
  • ty for ur help. – Yusran Mansyur Sep 07 '17 at 14:41