MATLAB: What is the equivalent of “extractAfter” function in MATLAB R2016a

extractafterstrings

Hi all,
I tried using the "extractAfter" function in MATLAB R2016a, but it returns an error message as "Undefined function or variable 'extractAfter'". Can anyone suggest me an equivalent of this function for R2016a? I know this function exists in R2018a. (Below is the description in R2018a)
https://nl.mathworks.com/help/matlab/ref/extractafter.html
Thanks, Krishna.

Best Answer

Maybe write your own replacement. E.g. a bare bones code with very little error checking:
function newStr = extractAfter_(str,startStrPos)
if( isnumeric(startStrPos) )
if( startStrPos > numel(str) )
error('Numeric position exceeds the number of characters.');
else
newStr = str(startStrPos+1:end);
end
else
s = strfind(str,startStrPos);
if( isempty(s) )
error('Conversion from <missing> to character vector is not supported.');
else
newStr = str(s(1)+numel(startStrPos):end);
end
end
end