Removing one length from a matrix
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amit Chakraborty
el 16 de Sept. de 2021
Comentada: Amit Chakraborty
el 16 de Sept. de 2021
I have a matrix which size is ,
A= 256x256x31;
And another Matrix (4D) ;
B=2031616x64 [ 4D format is : ( 256x256x31)x64]
I need to multiply matrix A with Matrix B . For the above scenario it will be not possible as dimension is not matching.
Can any one help so that the size of B becomes the size of A so that I can multiply them .
I tried with the squeeze but nothinh is happening there. So, little but confused.
0 comentarios
Respuesta aceptada
Walter Roberson
el 16 de Sept. de 2021
C = A .* reshape(B, size(A,1), size(A,2), size(A,3), []);
This assumes element-by-element multiplication, not matrix multiplication.
4 comentarios
Walter Roberson
el 16 de Sept. de 2021
Your post said
B=2031616x64 [ 4D format is : ( 256x256x31)x64]
but your code says
B= ones(256, 256, 31, 'single');
which is only 2031616 elements not 2031616x64 elements.
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrix Indexing 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!