Re: Multidimensional array to a matrix.
- From: Peter Boettcher <boettcher@xxxxxxxxxx>
- Date: Wed, 31 May 2006 09:01:08 -0400
"Ofer moshe" <mosheo@xxxxxxxxx> writes:
Hello
I have a mutlidimenstional array (i,j,k) i would like to change this
array to a matrix whose number of rows is the number of pages and the
number of columns is the number of elements in each page (rows time
columns in a single page).
In other words for each element (i,j) i need the the values for each
page as a row vector.
Is it possilbe to do this without for loops?
Internally, matrices are stored column-major (in order of the
indices). Reshape does not reorder any elements. Say A has size
m,n,p. Then
reshape(A, [m*n p]) is what you want. For other combinations, permute
would be necessary.
--
Peter Boettcher <boettcher@xxxxxxxxxx>
MIT Lincoln Laboratory
MATLAB FAQ: http://www.mit.edu/~pwb/cssm/
.
- References:
- Multidimensional array to a matrix.
- From: Ofer moshe
- Multidimensional array to a matrix.
- Prev by Date: Re: Multidimensional array to a matrix.
- Next by Date: Re: Multidimensional array to a matrix.
- Previous by thread: Re: Multidimensional array to a matrix.
- Next by thread: controlling the number of digits in a symbolic expression
- Index(es):