editbox clear command
Show older comments
m working on application where i put a clear botton i want that whenver i click on it it would clear all the fields data so i used this code in pushbotton clear(edit3,edit4,text1); but its not working so how to do this would you please tell me........
Answers (1)
Jan
on 22 Apr 2012
"It is not working" does not contain enough details to find a valuable advice. Please post the code. The CLEAR command clears variables from the workspace, but not the contents of UICONTROLs. Perhaps you want to set the contents explcitly:
set([edit3, edit4, text1], 'String', '');
4 Comments
emmi rdx
on 22 Apr 2012
Walter Roberson
on 22 Apr 2012
What error do you get?
Jan's solution is correct, provided you pass in the correct handles.
However, there is a possibility that some part of your code might have been written to assume that one of those handles always returns a cell array of strings rather than a string; in such a case you could use {''} instead of '' but better in such a case would be to use cellstr(get(HANDLE, 'string')) instead of just get(HANDLE, 'string')
Daniel Shub
on 22 Apr 2012
You also might need a drawnow.
Image Analyst
on 22 Apr 2012
If she used GUIDE, you would have to do
set(handles.edit3, 'String', '');
because the tag (the name of the edit box control) is always preceded by handles.
Categories
Find more on Variables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!