Question about indexing multi-dimensional matrices
Francesco Potorti`
Potorti at isti.cnr.it
Wed Sep 10 08:47:57 CDT 2008
>> 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: Potorti at isti.cnr.it
(entrance 20, 1st floor, room C71) Web: http://fly.isti.cnr.it/
More information about the Help-octave
mailing list