Receive an error when using an empty string array input in the "strrep" function.
Afficher commentaires plus anciens
When I use an empty string array as any of the three inputs to the "strrep" function, the function output is different in comparison to the "replace" function. However, their respective documentation pages appear to describe the same functionality.
As a particular example, when I try to run the following MATLAB code using the "strrep" function, I receive the following error message:
strrep(strings(1,0),["A","B"],["C","D"])
Error using strrep
All nonscalar inputs must be the same size.
However, if I use exactly the same input arguments for the "replace" function, there is no error message:
replace(strings(1,0),["A","B"],["C","D"])
ans =
1×0 empty string array
Is there a workaround to avoid this error message appearing when using "strrep"?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!