Delete array elements with Coder compatibility
Show older comments
I need to delete elements of a string with compatibility for Coder. For example:
myStr = 'This is a fun problem!'
myStr(10) = '';
Now this works just fine in Matlab, but I get an 'The right and left hand sides must have the same number of elements' error when I try to use Coder at the 'Check for Issuse' stage. I realize that I could do the following,
myStr = 'This is a fun problem!'
myStr = myStr([1:9,11:numel(myStr)]);
but this is ugly and challenging because I am doing this as part of a loop where the indexes would get complicated quickly.
Any ideas? Thanks.
Accepted Answer
More Answers (1)
Michael
on 15 Feb 2022
Categories
Find more on MATLAB Coder 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!