help-octave
[Top][All Lists]
Advanced

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

problem with non-sorted indices in l.h. sides of assignements


From: Mario Storti
Subject: problem with non-sorted indices in l.h. sides of assignements
Date: Tue, 29 Jul 1997 20:08:16 -0300

(Octave 2.0.5 in Linux/Pentium an Digital Unix/Alpha.)

Is this a bug? Should the vector of indices be sorted in the left hand
side of an assignment?

> octave> a=(1:10)'
> a =
> 
>    1
>    2
>    3
>    4
>    5
>    6
>    7
>    8
>    9
>   10
> 
> octave> a([1 3 2])=[]
> a =
> 
>    2
>    4
>    5
>    6
>    7
>    8
>    9
>   10
> 
> octave> 
> 

But if I sort the index vector the second element also is eliminated:

>  octave> a([1 2 3])=[]
> a =
> 
>    4
>    5
>    6
>    7
>    8
>    9
>   10
> 


I expected that the result should be independent of the sorting of the
index vector. (I'm not sure but I think that Matlab works this way.) I
read the chapter  "Assignment Ops" in the on-line  manual and it isn't
explicitly stated that the index vector has to be sorted.

Mario

%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%%<>%%%%%
Mario Alberto Storti               | Fax: (54)(42) 55.09.44 |
Grupo de Tecnologia Mecanica       | Tel: (54)(42) 55.91.75 |
INTEC, Guemes 3450 - 3000 Santa Fe | Home: Gob. Vera 3161   |
Argentina                          |       (54)(42) 55.00.23|
Reply: address@hidden  |                        |
                http://venus.unl.edu.ar/gtm-eng.html        |



reply via email to

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