help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: senseless warning in octave-3.6.2


From: Nicholas Jankowski
Subject: Re: senseless warning in octave-3.6.2
Date: Fri, 6 Jul 2012 11:56:35 -0400

On Fri, Jul 6, 2012 at 8:46 AM, Sergei Steshenko <address@hidden> wrote:
>
> octave:7> row_vec(1:2) = col_vec(1:2)
> row_vec =
>
>    5   6   3   4
>
> octave:8>
> "
>
> - no warnings, no nothing, just a silent automatic transformation.
>
> Regards,
>   Sergei.

actually, there was no transformation. you took the first two scalars
from col_vec and assigned them to the first two positions of row_vec.
you could have done the same for a multidimensional matrix. It didn't
transform orientation, it retained orientation on the original vector,
and assigned element values as you asked.

octave:17> a = 1:4
a =

   1   2   3   4

octave:18> b = a'
b =

   1
   2
   3
   4

octave:19> c = magic(4)
c =

   16    2    3   13
    5   11   10    8
    9    7    6   12
    4   14   15    1

octave:20> a(1:4)=c(7:10)
a =

    7   14    3   10

octave:21> b(1:4)=c(7:10)
b =

    7
   14
    3
   10

Matlab / Octave have always supported one dimensional addressing of
one and multidimensional arrays as it corresponds to how they're
stored in memory. No warnings because what you did was within the
realms of accepted array behavior since Matlab was first written.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]