Receive an error when using an empty string array input in the "strrep" function.
이전 댓글 표시
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"?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!