Matlab Define a hyphenated phrase to be a string containing
Matlab
Define a hyphenated phrase to be a string containing words separated by hyphens. For example \"help-me\" and \"hello-I-am\" are both hyphenated phrases. Write a Matlab function that makes a string containing a hyphenated phrase as its argument, and that returns the number of words in that phrase. Assume that there is exactly one hyphen between every pair of words in the phrase (e.g., your function will never receive strings such as \"hypher-phrase\".Solution
str = \'Here is a date: 01-Apr-2020\'; expression = \'(\\d+)-(\\w+)-(\\d+)\'; mydate = regexp(str,expression,\'tokens\'); mydate{:}
