How to replace a single word in a string with multiple row string?
Show older comments
Hello,
I am trying to replace a single word/token in a string variable with a string containing multiple rows of words. I get the following error using regexprep function :
Error using regexprep The 'REPLACE' input must be a one-dimensional array of char or cell arrays of strings.
I tried using strrep function as well. I get the following error for it :
Error using strrep Input strings must have one row.
A = strrep(B,'Keyword',C);
A = regexprep(B,'Keyword',C);
I am trying to replace Keyword in String B with C. C has multiple rows of words in it.
I searched the forum for similar questions. Did not find any.
How do i prevent this error? Please help.
1 Comment
Accepted Answer
More Answers (1)
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!