[PD] matlab to pd
Piotr Majdak
piotr at majdak.com
Fri Feb 4 10:38:44 CET 2005
Hi François,
f.bardet at voila.fr wrote:
> Can zexy lib process 3D matrices ? (I mean matrices with 3 indices,
e.g. a 10x8x3 matrix)
I don't know any details about zexy. Although, here is an idea, how to
handle every N-dimensional matrix as a linear vector:
To convert a matrix to a vector in Matlab use:
linvec = reshape(matrix, [],1);
which will reshape the matrix to a linear vector.
To access any single element you have to recalculate the index:
indexlin = k + K*l + K*L*m + K*L*M*n + ...
with:
- k,l,m,n...: index of first, second, third... dimension
- K,L,M,N: number of elements in each dimension.
By the way: this is more native way to treat matrices in computational
processing, because every matrix is stored in the RAM in the linear
order in any case :-) That's why your more-dimensional index is
recalculated to a linear index by every software which handles matrices.
regards,
Piotr Majdak
--
Piotr Majdak
Institut für Schallforschung
Österreichische Akademie der Wissenschaften
Reichsratsstr. 17
A-1010 Wien
Tel.: +43-1-4277-29511
Fax: +43-1-4277-9296
E-Mail: piotr at majdak.com
WWW: http://www.kfs.oeaw.ac.at
More information about the Pd-list
mailing list