Hi monu,
I think what you want to do is invoke your program (in the m-file) from a callback that is associated with your button. Presumably you are using GUIDE to develop your GUI with buttons and other widgets. Within the *.fig (GUIDE) layout for your GUI, double-click on the button that is to call your program. Observe the that Inspector: uicontrol(pushbutton…) window appears. Look for the Callback item and press the edit button (pencil on paper image) that is beside it. This should bring up your GUI *.m file with code similar to the following:
function pushbutton1_Callback(hObject, eventdata, handles)
Note that pushbutton1 is the name or Tag (see inspector window for Tag) for this button widget and so may be different from the tag assigned to your widget. This is just an empty function that (currently) does nothing but will get called whenever the user pushes the button on the GUI. It is within this function (pushbutton1_Callback) that you will add some code to invoke your program (in the other m-file):
[results] = otherProgram(…);
Now that you have called your other program and the results have been returned, these results should be displayed in an edit box on your GUI. Like this button whose Tag is 'pushbutton1' (in my example) the edit control will have its own unique Tag say "edit1". (Note that you can change these tag names to something more obvious given the nature of the button, edit control, etc.) The tag acts as an identifier within the list of handles for the GUI. So you can use the tag to get the control and update its contents like:
function pushbutton1_Callback(hObject, eventdata, handles)
[results] = otherProgram(…);
set(handles.edit1,'String',num2str(results));
Hope this helps!
geoff