Radio button option group adding space to end of string property
Show older comments
When I use findobj to search for a radio button in an option group based on each button's String property, I keep getting empty sets.
h = findobj(handle.optionGroup, 'String', strVariable);
I have discovered that a space character is being added to the end of the String of the buttons, so findobj never can match it to my variable. I have manuallly checked the property window multiple times for each button, and there are no extra spaces at the end of their strings.
Why does this happen?
Accepted Answer
More Answers (1)
Walter Roberson
on 11 Apr 2016
0 votes
Another possibility is that the handle visibility might be set to callback or off . You would need to use findall() instead of findobj() for those.
Are you setting the String property to a cell array of strings, or are you setting it to a string? If you are setting it to a string, does it include any "|" (or bar) characters? Safest is to set it to a cell array of strings.
Categories
Find more on App Building in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!