How do I extract a portion of a string after a prescribed symbol?

2 visualizaciones (últimos 30 días)
I have a string of the form
mystring='C\users\me\data\mymatrix.mat'
What operation will permit me to create the string consisting of all characters before the last '\'. In other words, what operation will yield the string
'C\users\me\data' ?
Perhaps the command strsplit could be used in some manner?

Respuesta aceptada

Stephen23
Stephen23 el 14 de Jun. de 2017
Editada: Stephen23 el 14 de Jun. de 2017
>> fileparts(mystring)
ans =
C\users\me\data

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by