10 CommentsOldest to Newest
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?
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.
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.
just call the separrate file in the same way you would any MATLAB function.
Can you please mention the syntax to call it, please?
Thanks a ton for all the help Doug.
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)?
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
Error in ==>
??? Error while evaluating uicontrol Callback
How can I fix it ?
Thank you !!!
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.