Stuart’s MATLAB Videos

Watch and Learn

MATLAB: Manipulating the data in a UItable in GUIDE 10

Posted by Doug Hull,

If you have a UItable in a UI made in GUIDE, you might want to change that data in a callback. For instance, you might want to change the values or increase the size of the dataset. This short video shows you the process to get the data into a variable, manipulate it, then set it back into the UItable.

10 CommentsOldest to Newest

Darshan Gajara replied on : 1 of 10

Thanks a ton Doug for helping me get started with GUIDE.
I’ve a MATLAB program that detects the skin of the user in real time via webcam. I want this program to run when I click the push button in the GUI designed using GUIDE. How should I go about it?

Doug replied on : 2 of 10

There is a callback associated with the button. You put the code you want to run in that callback. See the other GUI/GUIDE videos (list to left of blog) to find similar things.

Darshan Gajara replied on : 3 of 10

I did watch other GUIDE videos from here, but couldn’t find one that explains to directly enable to run a separate file by clicking the push button. Videos here explain the method to write functions under the callback function. I’m really confused about this part. I hope you rescue me out of this.

Nic Neogh replied on : 8 of 10

hai, i had create the uitable. after key in data in uitable, i would like to reset the data. i create a pushbutton to reset it, but it doesnt work. how i can reset the data in uitable after i click the reset (pushbutton)?

vetero replied on : 9 of 10

Sorry, I have a problem while I follow your tutorial, the code :
function add_gen_Callback(hObject, eventdata, handles)
% hObject handle to add_gen (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
data = get(handles.uitable2,’data’);
data(end+1,:) = 0;
And the error display in the command window when run this code :
??? Conversion to cell from double is not possible.

Error in ==> LMP_ver1>add_gen_Callback at 82
data(end+1,:) = 0;

Error in ==> gui_mainfcn at 96

Error in ==> LMP_ver1 at 42
gui_mainfcn(gui_State, varargin{:});

Error in ==>

??? Error while evaluating uicontrol Callback
How can I fix it ?
Thank you !!!

Stuart McGarrity replied on : 10 of 10

It looks like your uitable’s ‘Data’ property is a cell array. Do you initialize the “Data” property somewhere? I’d set a breakpoint at the error line and take a look at the value of the variable data.

Add A Comment

What is 3 + 7?

Preview: hide