MATLAB: How to apply function “strrep” to multiple substrings

MATLABmultiplesubstringsstrrep

Hi there,
It would be my great pleasure if anyone could assist me with the following error, caused after I applied strrep:
newIDFFile = strrep(readIDFFile, {'@@P1@@', num2str(u_gen_s)}, {'@@P2@@', num2str(u_gen_w)}, {'@@P3@@', num2str(u_gen_e)}, {'@@P4@@', num2str(u_gen_n)});
Also, I tried the following format:
newIDFFile = strrep(readIDFFile, '@@P1@@', num2str(u_gen_s), '@@P2@@', num2str(u_gen_w), '@@P3@@', num2str(u_gen_e), '@@P4@@', num2str(u_gen_n));
while the error message is:
Error using strrep
Too many input arguments.

Best Answer

newIDFFile = ...
strrep( ...
strrep(...
strrep( ...
strrep(readIDFFile, ...
'@@P1@@', num2str(u_gen_s)), ...
'@@P2@@', num2str(u_gen_w)), ...
'@@P3@@', num2str(u_gen_e)), ...
'@@P4@@', num2str(u_gen_n));