[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strjoin change ramifications with escape sequence behavior
From: |
Ben Abbott |
Subject: |
Re: strjoin change ramifications with escape sequence behavior |
Date: |
Sun, 16 Jun 2013 08:41:52 +0800 |
On Jun 16, 2013, at 7:37 AM, Daniel J Sebald wrote:
> On 06/15/2013 05:45 PM, Stefan Mahr wrote:
>>
>> That's true for your command above, but you need the extra brackets to
>> join the results:
>>
>> [[cstr(:).'; delimiter(:).']{:}]
>>
>>> while the return value after Stefan's change shows only the first
>>> portion of that result. I guess a routine can't return multiple answers.
>>
>> I think you lost the additional brackets, but no idea why.
>
> OK, thanks. Bad copy on my part. I'm seeing consistent results now.
>
> Dan
Dan, I think you did find a problem, but single-quotes are needed.
From Matlab
strjoin({'Octave','Scilab'}, '\n')
ans =
Octave
Scilab
From Octave
strjoin({'Octave','Scilab'}, '\n')
ans = Octave\nScilab
So the second string needs to be escaped.
What about the first? Trying Matlab again..
strjoin({'Octave\n','Scilab\n'}, 'foo')
ans =
Octave\nfooScilab\n
No. Only the second string.
So a patch that implements ..
strjoin({'Octave','Scilab'}, do_string_escapes ('\n'))
... should do the job.
Ben