[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
specifying one matrix index instead of two
From: |
Sergei Steshenko |
Subject: |
specifying one matrix index instead of two |
Date: |
Fri, 29 Jun 2012 15:49:23 -0700 (PDT) |
Hello,
in octave-3.6.2 I see:
"
octave:1> foo = [1 2 3; 4 5 6]
foo =
1 2 3
4 5 6
octave:2> foo(1)
ans = 1
octave:3> foo(2)
ans = 4
octave:4> foo(2, :)
ans =
4 5 6
octave:5> foo(1, :)
ans =
1 2 3
octave:6>
".
My question is regarding output of 'foo(1)', 'foo(2)' - my expectation is more
or less an error message rather than output of foo(1,1), foo(2,1) respectively.
Is it because of compatibility with Matlab ?
...
My point is that at the moment I am adding a dimension (vector -> 2d matrix),
so I'd rather receive an error message in case I forget to add index, i.e. in
case I forget to convert bar(L) -> bar(K,L).
Thanks,
Sergei.
- specifying one matrix index instead of two,
Sergei Steshenko <=