MATLAB: Add / before _ in a string

string

I need to add / before any underline in strings like "Mean_Tumor_Radius_prolif" so it will be "Mean/_Tumor/_Radius/_prolif".
Any suggestion?

Best Answer

There are many ways to do this, the simplest way is by the command "strrep"
str = 'Mean_Tumor_Radius_prolif'
replaced_str = strrep(str, '_', '/_');
replaced_str =
'Mean/_Tumor/_Radius/_prolif'