Using strrep for matrix
1 view (last 30 days)
Show older comments
Hello, I have some code that creates a scrambled character block of type char for instance
aaho
aoaa
daa
If i create a variable guess = 'hood'
how could i remove the word hood from the block and then display the block again with the removed 'hood'.
I have tried converting the block to a string array using "string()" then using "strrep() " to remove the the sequence and then convert it back to char but it did not work.
Any suggestions are greatly appeciated. Thanks in advance!
0 Comments
Answers (1)
Guillaume
on 19 Nov 2019
Keeping your 2d character array as is:
yourarray(ismember(yourarray, 'hood', 'rows'), :) = [];
or
yourarray(all(yourarray == 'hood', 2), :) = [];
See Also
Categories
Find more on Introduction to Installation and Licensing 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!