GUI modify uitable content

조회 수: 1 (최근 30일)
Giovanni
Giovanni 2011년 10월 28일
Hello,
this time I was trying to do something particular with uitable on a GUI. Basically I generate a big cell array, containing different type of data, and I display that using a uitable object (each line is kind of String, value, value, value, value). Then I have a listbox containing some messages, basically warnings happening at particular lines of the uitable.
For this reason I have saved a copy of the array with data, than I made it global, so accessible from the Callback i use to detect which line of the listbox is clicked, and so i do something like this:
function consolleOut_MousePressedCallbackData(hObject, eventdata, handles)
global jListbox
global w
global textdata
global selection2
global final
if eventdata.isMetaDown % right-click is like a Meta-button
clickType = 'Right-click';
else
clickType = 'Left-click';
end
mousePos = java.awt.Point(eventdata.getX, eventdata.getY);
clickedIndex = jListbox.locationToIndex(mousePos) + 1;
strw = w{clickedIndex};
strw = strw(1:19);
selection2 = find(strcmp(textdata, strw) == 1);
if numel(selection2) == 1
selected_data = final(selection2-4:selection2+5,:);
set(handles.uitable1, 'data', selected_data)
elseif numel(selection2) >= 1
selected_data = final(selection2(1)-4:selection2(1)+5,:);
set(handles.uitable1, 'data', selected_data)
end
Actually what i get is that selected_data is exactly a cell array, but MATLAB sends me back this error:
??? Attempt to reference field of non-structure array.
Error in ==> GUI>consolleOut_MousePressedCallbackData at 549 set(handles.uitable1, 'data', selected_data)
??? Attempt to reference field of non-structure array.
Error in ==> GUI>consolleOut_MousePressedCallbackData at 552 set(handles.uitable1, 'data', selected_data)
Which one could be the problem here? I already write the whole cell array (final) into the uitable inside another callback, but this shouldn´t be a problem....
Any ideas?
  댓글 수: 2
Jan
Jan 2011년 10월 28일
Please format your code as explained in the "Markup help" link on this page.
Giovanni
Giovanni 2011년 10월 28일
Wow...sorry I didn´t figure out! I will now, thanks! :)

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

답변 (1개)

Jan
Jan 2011년 10월 28일
It seems that handles is not a struct. Use the debugger to find out, what it is instead, and why - e.g. by:
dbstop if error
Then Matlab stops when the error occurs.

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by