diag incompat. with MATLAB

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

diag incompat. with MATLAB

Eyal Doron
Hi,
  Anybody come across this?

Matlab 4.0:

>>diag(eye(3))
ans =
     1
     1
     1

Octave 1.1.1 :

octave:3> diag(eye(3))
ans =

  1  1  1


Eyal Doron

Reply | Threaded
Open this post in threaded view
|

diag incompat. with MATLAB

John W. Eaton-6
Eyal Doron <[hidden email]> wrote:

: Anybody come across this?
:
: Matlab 4.0:
:
: >>diag(eye(3))
: ans =
:      1
:      1
:      1
:
: Octave 1.1.1 :
:
: octave:3> diag(eye(3))
: ans =
:
:   1  1  1

The result depends on the value of prefer_column_vectors.

Sometimes Matlab likes to create row vectors (for example, with
commands like clear x; for i = 1:3 x(i) = i; end) and sometimes it
insists on columns (things like x(:)).  I suppose this is Yet Another
Special Case...

jwe