bug in char, str2mat and strvcat behaviour?

Ben Abbott bpabbott at mac.com
Fri Nov 7 05:12:03 CST 2008


On Nov 7, 2008, at 5:58 AM, Thorsten Meyer wrote:

> Søren Hauberg wrote:
>> fre, 07 11 2008 kl. 00:09 +0100, skrev Thorsten Meyer:
>>> Could someone with access to matlab please try, what really  
>>> happens for the above
>>> examples?
>>
>> With Matlab 7.6.0.324 (R2008a) I get
>>
>>>> str2mat ('a', 'b', '', 'c')
>>
>> ans =
>>
>> a
>> b
>>
>> c
>>
>>>> char ('a', 'b', '', 'c')
>>
>> ans =
>>
>> a
>> b
>>
>> c
>>
>>>> strvcat ('a', 'b', '', 'c')
>>
>> ans =
>>
>> a
>> b
>> c
>>
>> So, the only difference seems to be in the 'char' function.
>>
>> Søren
>
> Thanks at lot. So char has a bug. Or maybe the problem lies even  
> deeper:
>
> octave:39> c=["a";"b";"";"d"]
> c =
>
> a
> b
> d
>
> Is that compatible behaviour?
>
> Could some of the c++ gurus help with this, please? I have tried to  
> find what happens in the source
> code but got terribly lost in all these overloaded methods for  
> convert_to_str_internal (even with
> the help of doxygen).
>

Running Matlab 2008b

 >> c=['a';'b';'';'d']

c =

a
b
d

Octave appears to have that correct.

Ben


More information about the Bug-octave mailing list