i need assistant making uitable
Show older comments
Guyz.. I need assistant about making GUI in matlab.. I wan to make 2 tables n 1 pushbutton. My prob is i cannot callback the data from the table to the pushbuttons.. These are my callback data for uitable1 n uitable2:
*table = get(hObject,'Data');
handles = guidata(hObject);
handles.table = table;
guidata(hObject, handles);**BOLD TEXT*
And then i put these coding into pushbuttons:
*handles = guidata(hObject);
table = handles.table;
table = cell2mat(table);
cost1 = get(handles.uitable1,'Data');
mwlimits1 = get(handles.uitable2,'Data');
Pdt1 = get(handles.input3_editText,'String');
guidata(hObject, handles);
cost = cell2mat(cost1);
mwlimits = cell2mat(mwlimits1);
Pdt = str2num(Pdt1);**BOLD TEXT*
Can anyone help me pls~~
Accepted Answer
More Answers (2)
Walter Roberson
on 8 Feb 2011
Your callback for uitable1 should be
handles.uitable1 = hObject;
guidata(hObject,handles);
Likewise for uitable2 except setting handles.uitable2
Then your callback for the pushbutton would be like,
cost1 = cell2mat(get(handles.uitable1,'Data'));
mwlimits1 = cell2mat(get(handles.uitable2,'Data'));
Pdt = str2num(get(handles.input3_editText,'String'));
but you haven't shown any code for actually doing anything with these matrices and number once you have them, so I cannot advise past this point.
The rest of the code you show for your callbacks appears to be unnecessary if you are working in Guide -- though starting with
handles = guidata(hObject);
would be needed if you were doing your own callback programming instead of having the callbacks generated by GUIDE.
Walter Roberson
on 8 Feb 2011
0 votes
This appears to be a continuation of your previous question, #924 and should probably have been posted as part of that.
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!