help-octave
[Top][All Lists]
Advanced

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

Re: Octave doesn't show quotes when strings which are cell array values


From: Sergei Steshenko
Subject: Re: Octave doesn't show quotes when strings which are cell array values are displayed
Date: Sun, 25 Nov 2012 11:34:47 -0800 (PST)




----- Original Message -----
> From: c. <address@hidden>
> To: Octave users list <address@hidden>
> Cc: Sergei Steshenko <address@hidden>
> Sent: Sunday, November 25, 2012 1:36 PM
> Subject: Re: Octave doesn't show quotes when strings which are cell array 
> values are displayed
> 
> 
> On 25 Nov 2012, at 12:32, c. wrote:
> 
>> 
>>  On 25 Nov 2012, at 11:31, Sergei Steshenko wrote:
>> 
>>>  Hello,
>>> 
>>>  here is a screen session:
>>> 
>>>  "
>>>  octave:27> CA{1}{1} = 2012
>>>  CA =
>>>  {
>>>   [1,1] =
>>>   {
>>>     [1,1] =  2012
>>>   }
>>>  }
>>>  octave:28> CA{1}{2} = "2012"
>>>  CA =
>>>  {
>>>   [1,1] =
>>>   {
>>>     [1,1] =  2012
>>>     [1,2] = 2012
>>>   }
>>>  }
>>>  octave:29> whos("CA{1}{1}")
>>>  Variables in the current scope:
>>> 
>>>    Attr Name          Size                     Bytes  Class
>>>    ==== ====          ====                     =====  =====
>>>         CA{1}{1}      1x1                          8  double
>>> 
>>>  Total is 1 element using 8 bytes
>>> 
>>>  octave:30> whos("CA{1}{2}")
>>>  Variables in the current scope:
>>> 
>>>    Attr Name          Size                     Bytes  Class
>>>    ==== ====          ====                     =====  =====
>>>         CA{1}{2}      1x4                          4  char
>>> 
>>>  Total is 4 elements using 4 bytes
>>> 
>>>  octave:31>  
>>>  ".
>>> 
>>>  One can see that except for whitespaces both '2012' are 
> displayed the same way, though Octave internally knows type - double vs char.
>>> 
>>>  So, why some kind of quotes is not displayed to indicate string values 
> ?
>>> 
>>>  Thanks,
>>>   Sergei.
>> 
>> 
>> 
>>  That's not really related to cell-arrays, that's the way Octave 
> displays strings:
>> 
>>>>  "2012"
>>  ans = 2012
>>>>  2012
>>  ans =  2012
> 
> 
> Matlab, instead, seems to behave differently depending on whether the string 
> is 
> an element in a cell array:
> 
>>>  2012  
> 
> ans =
> 
>         2012
> 
>>>  '2012'
> 
> ans =
> 
> 2012
> 
>>>  {2012,'2012'}
> 
> ans = 
> 
>     [2012]    '2012'
> 
>>> 
> 
> c.


So, it's a bug in Octave. And/or a useful missing feature.

I do not insist on exact Matlab behavior, but a clear indication whether a 
number is a string or a number would really help.

Regards,
  Sergei.




>


reply via email to

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