hello guys, i have code to show data in gui table
%%Database
data_plat = load('Data_PlatQ.mat');
Database_All = data_plat.Database_All;
data2 = table2cell(Database_All(strcmpi(Database_All.Plat, final_output), ...
{'Plat', 'Nama', 'Jurusan', 'Status'}));
data2 = [get(handles.uitable1, 'Data'); data2];
set(handles.uitable1, 'Data', data2);
when i run this code, it always replicate data in table, final_output is a number computed by the program which always changes because the program is processing video. i alrdy try unique and union function but still not work. how can i solve that?? any suggestion

 채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 12일

0 개 추천

set(handles.uitable1, 'Data', unique(data2, 'rows'));

댓글 수: 5

Yusran Said
Yusran Said 2017년 9월 12일
편집: Yusran Said 2017년 9월 12일
ty for answer that, but still have problem,
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in mpengujianbmpengujianbplay_Callback (line 220)
data2 = [get(handles.uitable1, 'Data'); data2];
main problem with unique function is, when i try this code
[~,idx]=unique(cell2mat(data2),'rows');
data2 = data2(idx,:);
its just work in first data, when second data in(final_output), it always error, say Dimensions of matrices being concatenated are not consistent.
Walter Roberson
Walter Roberson 2017년 9월 12일
We do not know how you initialized the data property of uitable1
Yusran Said
Yusran Said 2017년 9월 12일
data property of uitable1 is default,
keep current data value : To load data from a file, or to create data manually, first store the data in a workspace variable, then select the variable from the table below
Put in a breakpoint at the line
data2 = [get(handles.uitable1, 'Data'); data2];
and execute. When it stops, query
size(data2)
d1 = get(handles.uitable1, 'Data');
size(d1), class(d1)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Cell Arrays에 대해 자세히 알아보기

질문:

2017년 9월 12일

댓글:

2017년 9월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by