%% Replace Substring in String Array
% Replace placeholder text in a list of file names.
% Starting in R2017a, you can create strings using double quotes.

str = ["<ROOT_DIR>\MyData\data.tar.gz";
       "<ROOT_DIR>\MyScripts\cleandata.m";
       "<ROOT_DIR>\MyScripts\preprocess.m";
       "<ROOT_DIR>\MyScripts\publishResults.m"]

%
% If you are using R2016b, create string arrays using the string function instead of double quotes.
% Replace <ROOT_DIR> with a string that is the name of a file path.

old = "<ROOT_DIR>";
new = "C:\MyProject";
newStr = replace(str,old,new)

% Copyright 2012-2020 The MathWorks, Inc.