Borrar filtros
Borrar filtros

understanding the reshape function

26 visualizaciones (últimos 30 días)
Miguel Albuquerque
Miguel Albuquerque el 12 de Jul. de 2022
Editada: Jan el 12 de Jul. de 2022
Hey guys, I dont seem to undertsand what does this mean, I vre read a lot of thing, but this code is not explicit what it does, thank you.
surveillance_reshaped = reshape(Surveillance_signal, 100000, 1, []);
reference_reshaped = reshape(Reference_signal, 1000, 1, []);

Respuesta aceptada

Jan
Jan el 12 de Jul. de 2022
Editada: Jan el 12 de Jul. de 2022
reshape changes the dimensions of an array without changing the number of elements or their order. If you provide an empty matrix as dimension, the other given dimensions are used and the missing one is replaced such, that the total number of elements is not modified. So reshape(X, 1, []) creates a row vector.
It matters, that Matlab stores the element of arrays in columnwise order:
X = [1, 2; ...
3, 4; ...
5, 6];
reshape(X, 1, []) % or explicitly: reshape(X, 1, 6)
ans = 1×6
1 3 5 2 4 6
With providing more dimensions, a multi-dimonsional array is created:
reshape(X, 2, 1, [])
ans =
ans(:,:,1) = 1 3 ans(:,:,2) = 5 2 ans(:,:,3) = 4 6

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by