MATLABs strrep does things differently than I expected:
strrep('ababab', 'bab', 'bbb')
I hope that the strings will be replaced in stages, thus, first abbbab and than abbbbb . However, MATLAB returns abbbbbb (note the extra, 6th b at the end).
What does MATLAB do under the hood? Looking for indexes and then inserting a new row into each index? Is something completely different?
And, most importantly, how can I archive the intended result?
To be precise, the above example is just a minimal example of reducing additional sources of error. In the real world, I would like to replace sequences in integer vectors:
strrep([1 0 1 0 1 0], [0 1 0], [0 0 0])
and get
1 0 0 0 0 0
Thilo source share