%% Split String at Delimiter and Join with New Delimiter
% Create a string that contains the path to a folder. Starting in R2017a, you can create strings using double quotes.

myPath = "/Users/jdoe/My Documents/Examples"

%
% Split the path at the / character. split returns myFolders as a 5-by-1 string array. The first string is "" because myPath starts with the / character.

myFolders = split(myPath,"/")

%
% Join myFolders into a new path with \ as the delimiter. Add C: as the beginning of the path.

myNewPath = join(myFolders,"\");
myNewPath = 'C:' + myNewPath

% Copyright 2012 The MathWorks, Inc.