From: Miloš on
Hello everyone. I'm working on one project and I have this problem: i need to set text for static text object. Lets say its name is text1 and after pushing a button it should say "this is requested text".
code:

function pushbutton1_Callback(hObject, eventdata, handles)
.....
....
....
set(handles.text1,'String','this is requested text')

but it prints this error:
??? Reference to a cleared variable handles.
Error in ==> projekt_final>pushbutton1_Callback at 102
set(handles.text1,'String','this is requested text')

I'm not using text1 anywhere else in project.
Strange thing is that I was doing the same thing in my previous project and it worked. I'm really desperate, pls help. Thank in advance, Miloš.
From: Walter Roberson on
Miloš wrote:
> Hello everyone. I'm working on one project and I have this problem: i
> need to set text for static text object. Lets say its name is text1 and
> after pushing a button it should say "this is requested text".
> code:
>
> function pushbutton1_Callback(hObject, eventdata, handles)
> ....
> ...
> ...
> set(handles.text1,'String','this is requested text')
>
> but it prints this error: ??? Reference to a cleared variable handles.
> Error in ==> projekt_final>pushbutton1_Callback at 102
> set(handles.text1,'String','this is requested text')

Are you sure you didn't add a 'clear' command somewhere in the Callback ?

I've noticed a fair number of people routinely tossing on clear and clear all
statements in functions... never been able to figure out why.
From: Miloš on
Walter Roberson <roberson(a)hushmail.com> wrote in message <hodsqa$2p2$2(a)canopus.cc.umanitoba.ca>...
> Milo&#353; wrote:
> > Hello everyone. I'm working on one project and I have this problem: i
> > need to set text for static text object. Lets say its name is text1 and
> > after pushing a button it should say "this is requested text".
> > code:
> >
> > function pushbutton1_Callback(hObject, eventdata, handles)
> > ....
> > ...
> > ...
> > set(handles.text1,'String','this is requested text')
> >
> > but it prints this error: ??? Reference to a cleared variable handles.
> > Error in ==> projekt_final>pushbutton1_Callback at 102
> > set(handles.text1,'String','this is requested text')
>
> Are you sure you didn't add a 'clear' command somewhere in the Callback ?
>
> I've noticed a fair number of people routinely tossing on clear and clear all
> statements in functions... never been able to figure out why.

yes that was the problem, thank you very much !!! :)