|
|
error: "Reference to a cleared variable handles"
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š.
|
|
0
|
|
|
|
Reply
|
Milo
|
3/24/2010 8:26:04 PM |
|
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.
|
|
0
|
|
|
|
Reply
|
Walter
|
3/24/2010 8:31:04 PM
|
|
Walter Roberson <roberson@hushmail.com> wrote in message <hodsqa$2p2$2@canopus.cc.umanitoba.ca>...
> 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.
yes that was the problem, thank you very much !!! :)
|
|
0
|
|
|
|
Reply
|
Milo
|
3/24/2010 9:05:21 PM
|
|
|
2 Replies
857 Views
(page loaded in 0.035 seconds)
|
|
|
|
|
|
|
|
|