octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: char behavior


From: Rik
Subject: Re: char behavior
Date: Sat, 08 Oct 2011 22:35:59 -0700

On 10/08/2011 08:35 PM, Ben Abbott wrote:
> On Oct 8, 2011, at 11:04 PM, Rik <address@hidden> wrote:
>
>> On 10/08/2011 06:47 PM, address@hidden wrote:
>>> Running the developers sources (default branch), I see ...
>>>
>>>    size (char (1, 0))
>>>    ans =   2   1
>>>
>>> Does anyone else see this?
>>>
>>> Ben
>> Yes.  This is what you expect.  char() takes its arguments and concatenates
>> them vertically.  There were two input arguments so the resulting 2-D
>> character array will have two rows.
>>
>> It's easier to see with this code:
>>
>> char (97, 98)
>> ans =
>>
>> a
>> b
>>
>> size (ans)
>> ans =
>>
>>   2   1
>>
>> --Rik
> There is an incompatibility problem. 
>
> With char(M,N) ML returns a character array with size [MxN]
>
> Thus, char() should behave like ones(), zeros(), cell(), etc.
>
> Ben
Is this more undocumented Matlab weirdness?  I don't see this behavior in
their documentation (http://www.mathworks.com/help/techdoc/ref/char.html). 
What character did they choose to fill the new character matrix with?

This code snippet should produce a 5x3 matrix and show the integer value of
whatever fill character they used.

double (char (5, 3))

--Rik



reply via email to

[Prev in Thread] Current Thread [Next in Thread]