I want to change this string "D:\Adapters\04_easy\00_CodeGen\algo\gen\cdp" to get "D:\Adapters\04_easy\". Which function should I use? Regexprep doesn't seem to work.
1 view (last 30 days)
Show older comments
Anuj Berwal
on 2 Dec 2015
Answered: Walter Roberson
on 2 Dec 2015
srcpath="D:\Adapters\04_easy\00_CodeGen\algo\gen\cdp";
I want
newsrcpath="D:\Adapters\04_easy\";
0 Comments
Accepted Answer
Walter Roberson
on 2 Dec 2015
pos = find(srcpath == '\', 3, 'first');
newsrcpath = srcpath(1:pos(3))
0 Comments
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!