 <p>If you are using <code>GUIDE</code> for developing, every time you add a button to your <code>GUI</code> a chunk of code is generated:</p> <pre><code>% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) </code></pre> <p>This function is called every time you push the said button. So, if you need something to be executed when you click the button you just need to add the lines of code you want to execute below that generated chunk of code. For example, imagine you have an <code>edit text</code> variable called <code>edit1</code> with value</p> <pre><code>edit1 = 'hello'; </code></pre> <p>If you want to interact with it you need to call <code>handles</code>, but first you need to create a global variable:</p> <pre><code>%set the current figure handle to main application data setappdata(0,'figureHandle',gcf); %set the handles to figure's application data setappdata(gcf,'EDIT1',handles.edit1); </code></pre> <p>Then, in the callback function of your button you need write the following:</p> <pre><code>% --- Executes on button press in pushbutton1. function pushbutton1_Callback(hObject, eventdata, handles) % hObject handle to pushbutton1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) figureHandle = getappdata(0,'figureHandle'); EDIT1 = getappdata(figureHandle,'EDIT1 '); new_string = 'updated string'; set(EDIT1, 'String', new_string); </code></pre> <p>Hope this helps</p>