sum of row equal to particular number.

1 visualización (últimos 30 días)
parag gupta
parag gupta el 20 de Mzo. de 2019
Comentada: parag gupta el 20 de Mzo. de 2019
I have the following matrix
B = [2 2 2 3; ...
2 2 1 1; ...
4 5 2 1]
How to make sum of all these rows to be 0.0014. I mean sum of 1st row = 0.0014,sum of 2st row = 0.0014 and so on.Which matlab command I should use to transform the above matrix to a matrix with sum of 1st row = 0.0014,sum of 2st row = 0.0014 .
I tried to use randifix command but I dont want sum of coloums to be 0.0014.
Thanks
  2 comentarios
Jan
Jan el 20 de Mzo. de 2019
I do not know a function called "randifix". So please mention, what you mean.
parag gupta
parag gupta el 20 de Mzo. de 2019
sorry ..its " randfixedsum "

Iniciar sesión para comentar.

Respuesta aceptada

Jan
Jan el 20 de Mzo. de 2019
Editada: Jan el 20 de Mzo. de 2019
B = [2 2 2 3; ...
2 2 1 1; ...
4 5 2 1]
Result = B ./ sum(B, 2) * 0.0014 % Auto-expand: >= R2016b
  1 comentario
parag gupta
parag gupta el 20 de Mzo. de 2019
Editada: parag gupta el 20 de Mzo. de 2019
thank you very much jan !
:)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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!

Translated by