Hi, I have a matrix A(7x1001) and a matrix B(1x7).
I'd like to divide the first row of A for the first colum(element) of B,
second row of A for the second column in B, and so on.
A and B are in attached

 Respuesta aceptada

per isakson
per isakson el 11 de Dic. de 2019

0 votos

Try
C = A ./ reshape( U2, [],1 );

5 comentarios

Paul Rogers
Paul Rogers el 12 de Dic. de 2019
thanks but not working.
Guillaume
Guillaume el 12 de Dic. de 2019
not working is a completely useless statement on its own.
It's not working because...
  • you get an error, if so what is the full text of the error message?
  • not giving you the result you expected, if so what did you get and how does it differ from what you expected?
We can't see your screen so can't guess why it's not working.
Completely unrelated, if A is 7x1001 why isn't B 7x1 instead of 1x7 to be consistent?
Paul Rogers
Paul Rogers el 12 de Dic. de 2019
sorry, I get this:
Error using ./
Matrix dimensions must agree.
A is 7x1001 and B is 1x7
Guillaume
Guillaume el 12 de Dic. de 2019
Oh, you're on a very old version, which doesn't have implicit expansion:
C = bsxfun(@rdivide, A, B(:));
However, again, why isn't B a column vector (7x1) instead of a row vector (1x7)? This would avoid the transpose/reshape and would make it consistent with the shape of A.
Paul Rogers
Paul Rogers el 12 de Dic. de 2019
thanks man it's this!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Productos

Versión

R2014b

Preguntada:

el 11 de Dic. de 2019

Comentada:

el 12 de Dic. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by