GUI modify uitable content
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Jan
il 28 Ott 2011
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.
0 Commenti
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!