divide 3d matrix (840,64,1536) by 1d matrix (1536,1)

6 visualizaciones (últimos 30 días)
Florian Bauer
Florian Bauer el 7 de Feb. de 2020
Respondida: Florian Bauer el 7 de Feb. de 2020
Hello community !
I need help for a simple problem:
I have a matrix A of Dimension (840,64,1536) and a matrix B of dimension (1536,1)
I need to divide each set A(840,64, i ) by the i-th value of B B(i).
I could do a clumpsy for loop, but would like a smarter approach.
Thanky you for your support!
Florian.

Respuesta aceptada

Stephen23
Stephen23 el 7 de Feb. de 2020
bsxfun(@rdivide,A,reshape(B,1,1,[]))

Más respuestas (2)

Adam
Adam el 7 de Feb. de 2020
A ./ reshape( B, [1 1 1536] );

Florian Bauer
Florian Bauer el 7 de Feb. de 2020
Both work perfect !
THANK YOU ! ! !

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by