[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about indexing multi-dimensional matrices
From: |
Francesco Potorti` |
Subject: |
Re: Question about indexing multi-dimensional matrices |
Date: |
Wed, 10 Sep 2008 15:47:57 +0200 |
>> 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).
--
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/