octave-maintainers
[Top][All Lists]
Advanced

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

assignment expresion


From: John W. Eaton
Subject: assignment expresion
Date: Mon, 9 Dec 1996 10:33:02 -0600

On  9-Dec-1996, Andreas Weingessel <address@hidden> wrote:

: A matrix assignment of the form
:       A(:,1) = some_colum_vector
: does not work, when A has not been defined before. This kind of
: assignment was possible in previous versions.

I goofed when trying to make this kind of assignment

  a = zeros (4, 5);
  a(:, 1) = 1;

actually fill the column instead of just assigning one element.

Here is a patch:

Index: Array2-idx.h
===================================================================
RCS file: /home/jwe/src/master/octave/liboctave/Array2-idx.h,v
retrieving revision 1.7
diff -c -r1.7 Array2-idx.h
*** Array2-idx.h        1996/12/06 21:12:30     1.7
--- Array2-idx.h        1996/12/07 05:42:23
***************
*** 365,374 ****
        int idx_j_is_colon = idx_j.is_colon ();
  
        if (idx_i_is_colon)
!       n = lhs_nr;
  
        if (idx_j_is_colon)
!       m = lhs_nc;
  
        if (idx_i && idx_j)
        {
--- 365,374 ----
        int idx_j_is_colon = idx_j.is_colon ();
  
        if (idx_i_is_colon)
!       n = lhs_nr > 0 ? lhs_nr : rhs_nr;
  
        if (idx_j_is_colon)
!       m = lhs_nc > 0 ? lhs_nc : rhs_nc;
  
        if (idx_i && idx_j)
        {



Thanks,

jwe


reply via email to

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