[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: |
c. |
Subject: |
Re: Octave doesn't show quotes when strings which are cell array values are displayed |
Date: |
Sun, 25 Nov 2012 12:36:01 +0100 |
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.