Reshape 2D matrix to 3D using time as 3rd dimension
Afficher commentaires plus anciens
Hi,
I've got a A = n x n matrix and I want to convert this 2D matrix to a 3D one using time as the third dimension. So the 3D should show how the value of all the elements in the n x n matrix changes with respect to time.
I tried using the reshape function but to no avail.
Thanks!
Réponse acceptée
Plus de réponses (1)
Matt J
le 28 Oct 2015
0 votes
I tried using the reshape function but to no avail.
Be more persistent. RESHAPE is the appropriate thing to use.
2 commentaires
lmaree
le 12 Mar 2021
"Beyond the second dimension, the output, B, does not reflect trailing dimensions with a size of 1. For example, reshape(A,3,2,1,1) produces a 3-by-2 matrix." from the reshape documentation.
In my case, this is exactly what I need to multiply a spacial 2D matrix with a time vector. However, reshape doesn't have the functionality it seems...
It is not needed. There is no difference between what you can do with a 3x2 matrix and with a 3x2x1x1 matrix.
A=rand(3,2);
t=rand(1,1,1,4);
A.*t
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!