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

1 次查看(过去 30 天)
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?

采纳的回答

Stephen23
Stephen23 2017-6-14
编辑:Stephen23 2017-6-14
>> fileparts(mystring)
ans =
C\users\me\data

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Characters and Strings 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by