Hi ,
I am working on a project where i need to use push buttons. On pressing a button , I want to execute a m file already written and change the values of a particular row in the GUI table.
I am a beginner and need some help. Please help me on how to edit the call back function and change the data in the table.
Thanks in advance.
Regards.
Jayadeep Kodali
No products are associated with this question.
Open your GUI figure file by right clicking on its name in the MATLAB current folder window and choosing GUIDE.
Find the push button in the GUIDE opened design window.
Right click on the push button and find it's callback function.
An editor will open up and shows the callback function of the pushbutton.
Put the name of the script m-file or the function you have previously written in the callback function.
You are done. Test the GUI.
@Babak I have one more question. can I change the data of a particular row in a UITABLE after implementing a particular push button. if yes can you give me an example.
What I am doing is using push button to each row in my GUI and after pressing this push button, matlab communicates with an instrument and after I receive the values I need to change them in the table here.
Please help.
Yes you can change the data in the uitable.
First get the tag of the uitable: the name you call it. for example mytable
in the pushbutton callback function, before running the callback m-file you have written you need to add a few lines to get the table's data:
mytbldata = get(handles.mytable,'data');
then after you run your m-file, add another line to edit the table's data:
// for example 3rd row: mytbldata(3,:) = cell(ones(1,10)); // mytbldata is usually cell object
then add this line to overwrite the new table data to the table in the GUI:
set(handles.mytable,'data',mytbldata); guidata(hObject,handles); // to update the GUI
0 Comments