help-octave
[Top][All Lists]
Advanced

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

Re: Saving


From: Francesco Potorti`
Subject: Re: Saving
Date: Wed, 05 Dec 2007 11:31:35 +0100

>>for i = 1 : n
>>V(i,j) = V(i,j) + I;
>>end 
>
>I do not understand your question, but the above should be rewritten,
>for speed and clarity, like this:
>
>V(1:n,j) += I;
>
>When I used what Francesco suggested, I got the
>following error message. 
>
>error: A(IDX-LIST) = X: X must be a scalar or size of
>X must equal number of elements indexed by IDX-LIST
>error: assignment failed, or no method for `matrix =
>matrix'
>error: evaluating assignment expression near line 78,
>column 10

That may depend on what values you have in i, j, V and I.  As an
example, look at this.  If you understand how it works, you may be able
to correct your problem:

octave2.1> a=vander(1:5), N=4, j=2, I=-1
      a =

          1    1    1    1    1
         16    8    4    2    1
         81   27    9    3    1
        256   64   16    4    1
        625  125   25    5    1

      N = 4
      j = 2
      I = -1
octave2.1> a(1:n,j)=I
      a =

           1    -1     1     1     1
          16    -1     4     2     1
          81    -1     9     3     1
         256    -1    16     4     1
         625   125    25     5     1

-- 
Francesco Potortì (ricercatore)        Voice: +39 050 315 3058 (op.2111)
ISTI - Area della ricerca CNR          Fax:   +39 050 315 2040
via G. Moruzzi 1, I-56124 Pisa         Email: address@hidden
Web: http://fly.isti.cnr.it/           Key:   fly.isti.cnr.it/public.key


reply via email to

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