MATLAB: Does the FINDOBJ command not work when I use the “-regexp” flag in MATLAB

expressionMATLABregular

When I use the following commands:
figure; uicontrol('string','testing 123...');
h=findobj(gcf,'-regexp','String','[.*123.*]');
The variable "h" is empty which means that the object was not found by FINDOBJ command.

Best Answer

The ability to use the FINDOBJ command with the "-regexp" option that searches for UI Control objects that have a particular "String" property is not available in MATLAB.
To work around this issue, you can search for UI Control objects based on other properties such as their Tags or their Names, for example:
figure; uicontrol('String','testing 123...','Tag','testing 123...')
h=findobj(gcf,'-regexp','Tag','.*123.*');