MATLAB: Report progress from sub function in a GUI

figureguideMATLAB

Hi,
I have a GUI that I want to make into a standalone application. The program it is the interface for takes quite a while to run, so when it is being used in the MatLab environment I report it's progress with fprintf in the command window. When the user presses a push button, it calls a function and there is a long chain of sub functions down to the one that takes ages. All I want to is add a line of code to the sub function that updates a static text box on the GUI, but I have no idea how to refer to this static text box from the sub function. I've tried set(gcf.handles.statictext1,'string','PercentComplete') with no success. I can't find anything on the net even though this is probably really simple!
Any ideas? Thanks for your help.

Best Answer

handles = guidata(gcf);
set(handles.statictext1, 'string', 'PercentComplete');