MATLAB: Separate path string into drive and folders

filename constructionfilepartsfullfile

Hi,
using fileparts brings the path, the name and the exentension of a fullfile (e.g., C:\user\files\myFile.txt). Is there a function that separates the path into drive and folders, so that drive = 'C:' folder1 = 'user' folder2 = 'files' ?
Thx, Philipp

Best Answer

s='C:\user\files\myFile.txt'
out=regexp(s,'\','split')