How to insert a matrix into another matrix
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a vector of a length up to 2500. How do I reshape this vector of any size up to 50x50 (For example if I don't have 2500 elements, and only have 625, how would I reshape that into a 25x25) and then insert it into a specific point on a 256x256 matrix.
I basically need to insert a smaller matrix into a larger one at a specific point. I am thinking I need to use a for loop.
1 comentario
David Hill
el 20 de Abr. de 2020
If you only have 625 elements, you cannot get a 2500 element matrix. You would have to pad with nan's or zeros or something. Additionally, you did not describe how you wanted the element arraigned in the 50x50 matrix. Inserting a 50x50 matrix into an existing 256x256 matrix is not hard. If m is the 50x50 matrix and M is the 256x256 matrix, then:
M(a:a+49,b:b+49)=m;
Respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!