What is an alternative for 'extractBefore' in MATLAB 2015b
8 次查看(过去 30 天)
显示 更早的评论
The function "extractBefore" does not suit the MATLAB 2015b and it shows an error of, Undefined function or variable 'extractBefore'.
0 个评论
回答(2 个)
Manikanta Aditya
2023-3-20
Hi Kavin,
As per my understanding, you want to get an alternative for ‘extractBefore’ function in MATLAB 2015b.
The ‘extractBefore’ function was introduced in MATLAB R2016b and is not available in earlier versions such as MATLAB 2015b. If you are using MATLAB 2015b and need to extract a substring before a specific character or set of characters, as a workaround, you can use the ‘strfind’ function instead, to find the indexes. Using these indexes, you can slice the substrings from your string.
For further reference, please check this link to know more about ‘strfind’ function:
I hope this resolves the issue you are facing.
0 个评论
Image Analyst
2023-3-20
编辑:Image Analyst
2023-3-20
Try it this way
str = 'Image Analyst, Image Analyst';
indexes = strfind(str, 'Analyst')
extractedBeforeString = str(1:indexes(1) - 1)
extractedAfterString = str(indexes(1) : end)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!