Matlab help — How to replace a word using findstr?

  • Topic: MATLAB 
  • Thread starter tdang
  • Start date
  • Tags Tags
    Matlab
2 replies · 2K views · last reply
tdang
Messages
1
Reaction score
0
TL;DR
How to replace a word using findstr
Matlab help!
Hello
I want to create a sentence 2

sen1: I love flower
str1: love
str2: hate

How can I create sen2= "I hate flower" using findstr and array concatenation?
 
In any case, for reliable use in large documents, you should do something to only replace whole words and to match regardless of capitalization. I am sure that MATLAB has some regular expressions to allow that.
 
There is an extrensive documentation from Matlab on strings here which should cover everything you need. Take a look at strrep for example.