Why are you trying to do this? If you're trying to modify the copy and later run the modified copy, I would instead have the function accept input arguments related to the change and take action based on the specific values with which it is called.
For example, if I wanted to have a function that can display either the sine, cosine, or tangent of a set of data you could have a function that you copy and modify, or you could have a function that accepts the trig function:
plot(x, funToPlot(x), 'DisplayName', func2str(funToPlot))
error("This function, as written, can only process " + ...
"the sine, cosine, and tangent functions");
plot(x, y, 'DisplayName', name)