Matlab help — How to replace a word using findstr?

  • Context: MATLAB 
  • Thread starter Thread starter tdang
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
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?
 
Physics news on Phys.org
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.
 
Reply
  • Like
Likes   Reactions: FactChecker