Say if we have this string
a = 'C:/my_folder/folder/mac/data/';
How can I use regexprep to reduce the string to:
'C:/my_folder/folder/mac/';
答案 0 :(得分:0)
Actually, I found a way to do it.
[pathstr] = fileparts(a);
regexprep(pathstr, '(?<=/)[^/]*$', '')
答案 1 :(得分:0)
您可以尝试使用此方法在字符串结尾处剪切5个字符 a = a(1:结束-5)