What is an alternative for 'extractBefore' in MATLAB 2015b

15 visualizaciones (últimos 30 días)
KAVINKUMAR V S
KAVINKUMAR V S el 20 de Mzo. de 2023
Editada: Image Analyst el 20 de Mzo. de 2023
The function "extractBefore" does not suit the MATLAB 2015b and it shows an error of, Undefined function or variable 'extractBefore'.

Respuestas (2)

Manikanta Aditya
Manikanta Aditya el 20 de Mzo. de 2023
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.

Image Analyst
Image Analyst el 20 de Mzo. de 2023
Editada: Image Analyst el 20 de Mzo. de 2023
Try it this way
str = 'Image Analyst, Image Analyst';
indexes = strfind(str, 'Analyst')
indexes = 1×2
7 22
extractedBeforeString = str(1:indexes(1) - 1)
extractedBeforeString = 'Image '
extractedAfterString = str(indexes(1) : end)
extractedAfterString = 'Analyst, Image Analyst'

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by