[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: specifying one matrix index instead of two
From: |
c. |
Subject: |
Re: specifying one matrix index instead of two |
Date: |
Sat, 30 Jun 2012 02:37:42 +0200 |
On 30 Jun 2012, at 00:49, Sergei Steshenko wrote:
> 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 ?
Yes.
> ...
>
> 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.