MATLAB Answers

0

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

Asked by Paul Fishback on 14 Jun 2017
Latest activity Commented on by Paul Fishback on 14 Jun 2017
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?

  0 Comments

Sign in to comment.

Tags

Products

1 Answer

Answer by Stephen Cobeldick on 14 Jun 2017
Edited by Stephen Cobeldick on 14 Jun 2017
 Accepted Answer

>> fileparts(mystring)
ans =
C\users\me\data

  1 Comment

Sign in to comment.