MATLAB: How to use regexp to split the filepath

regexp

file path= C:\Data\Project\PCOD\PCOD_Model.mdl
I want the model path only like C:\Data\Project\PCOD\…. how can I do it

Best Answer

Use the fileparts() function, not regexp():
[folder, baseFileName, extension] = fileparts(yourFilePath);