help-octave
[Top][All Lists]
Advanced

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

foo = eye (5); foo(1:3,:)(1:6) = 1


From: Etienne Grossmann
Subject: foo = eye (5); foo(1:3,:)(1:6) = 1
Date: Thu, 18 Mar 2004 17:13:16 -0500
User-agent: Mutt/1.4.2.1i

  Hello,


I was surprised to see that 

   foo = eye (5); foo(1:3,:)(1:6) = 1


   error: in indexed assignment of matrix, last lhs index must be ()
   error: assignment failed, or no method for `matrix = scalar'
   error: evaluating assignment expression near line 32, column 32

doesn't work w/ octave-2.1.53. Is that normal, or a bug?

  The only workaround I can think of is :

   foo(reshape(1:prod(size(foo)),size(foo))(1:3,:)(1:6)) = 1

   foo =
 
      1  1  0  0  0
      1  1  0  0  0
      1  1  1  0  0
      0  0  0  1  0
      0  0  0  0  1

  Can anyone give me some insight?

  Cheers,

  Etienne 

-- 
Etienne Grossmann ------ http://www.cs.uky.edu/~etienne



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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