According to the documentation, STRSPLIT is supposed to work like this:
C = strsplit('a\nb','\n')C =1×2 cell array 'a' 'b'
However, I get
C =cell 'a\nb'
and
C = strsplit('a\nb','\\n')C =1×2 cell array 'a' 'b'
Why does the backslash need to be escaped? Is this an error in the code or in the documentation, or am I missing something? I use MATLAB R2017a.
I am aware of SPLIT, which works as described in the documentation and is perfectly applicable, but the recommendation over STRSPLIT is only noted in STRSPLIT's "Tips" section, which I discovered only after fiddling with STRSPLIT.
Best Answer