help-octave
[Top][All Lists]
Advanced

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

Re: Question about indexing multi-dimensional matrices


From: Jaroslav Hajek
Subject: Re: Question about indexing multi-dimensional matrices
Date: Wed, 10 Sep 2008 15:59:59 +0200

On Wed, Sep 10, 2008 at 3:47 PM, Francesco Potorti` <address@hidden> wrote:
>>> N = [3 3 4];
>>> A = zeros(N);
>>> idx = [1 3 2];
>>> iidx = num2cell(idx);
>>> A( iidx{:} ) = 1;
>>
>>... This is called "Fortran" or "linear" indexing and is,
>>by default, available for any array.
>
> I do not think so.
>
> This is a trick by which you provide several argument to A() by using
> a comma-separated list: in this case, A() gets three arguments, while
> with linear indexing you would provide only one (the one computed by
> sub2ind).
>

You're right. I didn't read the code carefully.


> --
> 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
> (entrance 20, 1st floor, room C71)     Web:   http://fly.isti.cnr.it/
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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