フィルターのクリア

GUI modify uitable content

2 ビュー (過去 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 Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by