How could normalize a matrix between 0 and 1.

9 visualizzazioni (ultimi 30 giorni)
Edu Gomez
Edu Gomez il 2 Mag 2019
Modificato: Jan il 3 Mag 2019
I have a matrix 14x15536 how it shows in the picture, and i would like to normalize each row between 0 and 1.
How could I do it??
Thanks in advance.

Risposte (2)

Stephan
Stephan il 2 Mag 2019
result = normalize(x,2,'range')
  11 Commenti
Jan
Jan il 3 Mag 2019
Modificato: Jan il 3 Mag 2019
Edu Gomez uses R2015a, so no auto-expanding, which was introduced in R2016b. Then bsxfun is required:
rowMin = min(x, [], 2);
result = bsxfun(@minus, x, rowMin) ./ bsxfun(@minus, max(x, [], 2), rowMin);

Accedi per commentare.


Edu Gomez
Edu Gomez il 3 Mag 2019
I want say thanks to both for you time and your help, Its very rewarding to have your help for this. Im doing a master thesis and I need a little help with Matlab sometimes.
Thank you very much :))

Categorie

Scopri di più su Sparse Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by