STRPAT searches for EXACTLY matching patterns
in a character or numeric string and replaces
the occurrences with another pattern.
a single or double precision pattern
may include NaNs
% - character strings
% note difference
% - numeric strings
% 1 2 3 NaN 5 6 7
% 3.1416 6.2832 9.4248 18.85
strpat(pi*(1:6),pi*(4:5),[nan inf -inf nan])
% 3.1416 6.2832 9.4248 NaN Inf -Inf NaN 18.85
% 3.1416 6.2832 9.4248 1 2 3 18.85
% - PATTERN including NaNs
% -10 Inf -10 NaN Inf Inf -10
>> help strpat
or the screenshot for help on this self-explanatory function
us (2020). strpat: a pedestrian, exactly matching pattern finder / replacer (https://www.mathworks.com/matlabcentral/fileexchange/1518-strpat-a-pedestrian-exactly-matching-pattern-finder-replacer), MATLAB Central File Exchange. Retrieved .
excellent. overcomes the short comings of regexprep
I downloaded it because I found it at 2nd place at "Most downloaded"!, and I found it very useful. I just would prefer a WARNING message instead of a DISPLAY, in order to be able to avoid it and just looking into the .n field at the second output, which, by the way, was very clever.
Thanks us for the submission.
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!