delete function doesnt work

function names_Callback(hObject, eventdata, handles)
d=get(handles.textvis,'Value');
if d==1
delete (handles.texthandles(:));
end
I tried deleting some handle objects, depending on the value of d, but it didnt work.
P.S.- it worked well when i didnt had this 'if loop'. I am not able to detect the problem.

 採用された回答

Matt Fig
Matt Fig 2012 年 10 月 14 日

0 投票

Did you look at the value of d? Perhaps it is not 1... Take the semicolon off, see what prints to the command window when you trigger that callback.
P.S. There is no such thing as an "if loop", only "if statements."

5 件のコメント

Walter Roberson
Walter Roberson 2012 年 10 月 14 日
The "textvis" is suggestive that it might be a uicontrol('Style','text'), in which case Value would be meaningless ('String' being meaningful but non-numeric)
Matt Fig
Matt Fig 2012 年 10 月 14 日
I agree, the value is not set by the uicontrol if it is an editbox or a text. But Shree may be using it as a switch by setting it in another callback or whatever. I have only guesses as to what is going on due to a lack of details in the OP...
Shree Nath
Shree Nath 2012 年 10 月 14 日
@Matt : I tried displaying the value.. it is 1 each time, yet this isnt working. Is there any other way to do it? P.S.- Oopsy :P
@Walter -that is taken care of..this is a variable depicting the handles visiblity, taking values 0 and 1. This works well. Problem is with deleting function.
Walter Roberson
Walter Roberson 2012 年 10 月 14 日
Put in a breakpoint at the delete() call. Do you reach that point?
If it is "a variable depicting the handles visibility", then is it a uicontrol() and if so what Style is it? If it isn't a handle graphics handle, then get() is not appropriate for it.
Try displaying d-1 to see whether the value might be near 1 but not exactly equal to it.
Shree Nath
Shree Nath 2012 年 10 月 14 日
I made textvis as a variable stored in handles structure, accordingly changed the code, but still no good.
i see the problem... compiler doesnt reach that point.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by