GUIDE: Text edit. Structure of handles.edit changed?
3 次查看(过去 30 天)
显示 更早的评论
Hello -
This could be really trivial but I don't seem to figure it out what went wrong. I have a GUI that user browse to a directory, then I have an edit text box performs some regexp operation of the directory name and give an output in the text box - which the users can leave it as if if they're happy with the choice or do any modification. The problem I'm having is that if they user leaves the text as is, I can retrieve the text from handles.edit.String (or get(handles.edit,'String'). If text box gets modified, the UIcontrol structer disappears, and the input text is store as handles.edit.
Is there a way to keep the structure of the variable the same so I don't have to do any precheck on handles.edit? What could I may have done incorrectly? I'm using R2015a.
Thank you for any suggestion! Pearl
0 个评论
采纳的回答
Sid
2015-7-7
The easiest solution might be to create a separate function (say, formatString ) that is the callback for the editbox and the pushbutton (which I am guessing is how the user can browse to the desired directory.)
The formatString function will serve the sole purpose of doing the regexp to format the string, and set the output to the editbox string.
Doug Hull (or Stuart now) had a good example here on this kind of operation. It might be worth the few minutes to watch? You can find the video here .
Again, the message is set up one function that can be called upon from different locations (in this case the original pushbutton and then the editbox .) This way, it might be easier to scale up later on.
A bit of a long-winded answer, but HTH.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!