[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [foo{:}] - feature or bug ? (octave-3.4.2)
From: |
Sergei Steshenko |
Subject: |
Re: [foo{:}] - feature or bug ? (octave-3.4.2) |
Date: |
Sun, 7 Aug 2011 10:22:23 -0700 (PDT) |
--- On Sat, 8/6/11, James Sherman Jr. <address@hidden> wrote:
From: James Sherman Jr. <address@hidden>
Subject: Re: [foo{:}] - feature or bug ? (octave-3.4.2)
To: "Sergei Steshenko" <address@hidden>
Cc: address@hidden
Date: Saturday, August 6, 2011, 5:32 AM
I do _not_ see any trace of "[1 2 3 4]" vector ?
You do see a trace in the fact that there is emptiness there (not simply out of
bounds). The problem is that octave matrices (AFAIK) can only hold one type of
element. So, when you concatenate a char matrix with a double matrix, I
believe octave defaults to a char matrix. I'm using 3.2.4 still, but this is
what I get for concatenation:
octave-3.2.4.exe:20> a = "a"a = aoctave-3.2.4.exe:21> b = [1 2 3 4]b =
1 2 3 4
octave-3.2.4.exe:22> c = [a b]
c = a☺☻♥♦
So the b variable is interpreted in funny characters (presumably corresponding
to 1 2 3 4 in whatever encoding octave is using).You can see this in the whos:
octave-3.2.4.exe:26> whosVariables in the current scope:
Attr Name Size Bytes Class ==== ====
==== ===== =====
a 1x1 1 char b
1x4 32 double c
1x5 5 char
So the reason you're seeing emptiness is probably because whatever in coding
your using for characters, the corresponding characters for the numbers 1, 2, 3
and 4 are blank or maybe unprintable.
Hope this helps.
--------------------------------------------------------------------------
Why did 'octave' in my example choose to convert to 'char' and not to
'double' ?
In case of mixed data types like in my case which part of 'octave'
documentation describes choosing of destination data type ?
Thanks,
Sergei.