How to suppress message of validatestring?

1 view (last 30 days)
z = validatestring( 'azaa', {'aaa','bbb'} );
outputs in red to the Command Window
Expected input to match one of these strings:
'aaa', 'bbb'
The input, 'azaa', did not match any of the valid strings.
Is there a way to suppress this message?
I would like to get this information in an output argument and take control over the presentation.
I reckon it's straight forward to make my own version of validatestring and shadow the factory version.

Accepted Answer

Walter Roberson
Walter Roberson on 1 Mar 2018
validatestring() is mostly a whole lot of throw(), so if you do not want the message, put in a catch
  2 Comments
per isakson
per isakson on 1 Mar 2018
Thanks! Of course, time for me to take a break.
Steven Lord
Steven Lord on 1 Mar 2018
No, break exits a for or while loop. You want to go outside and play a game of catch :)

Sign in to comment.

More Answers (0)

Categories

Find more on Argument Definitions 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!