How to code an equation with a variable that implies to all cell and save in same size of input array (using nested for loop)

1 vue (au cours des 30 derniers jours)
data =xlsread('***');%%data is 100x1632 double
[m, n] = size(data);
min1 = min(data);
max1 = max(data);
for i=1:m
for x=1:n
MinMaxFunction=(data(i,x)-min1)/(max1-min1)*(1-(-1))+(-1);
end
end
  1 commentaire
dpb
dpb le 28 Fév 2021
%%data is 100x1632 double
[m, n] = size(data);
min1 = min(data);
max1 = max(data);
Given array data is 2D, then min1, max1 are row vectors of length n.
So,what is wanted as a result of the normalization operation
MinMaxFunction=(data(i,x)-min1)/(max1-min1);
? To scale everything to the maximum overall in the entire array or each row to its max, range, ...???
Presuming it is overall, see Answer below, if something else, give us more specifics.

Connectez-vous pour commenter.

Réponses (1)

dpb
dpb le 28 Fév 2021
data =xlsread('***');
minOverall=min(data,[],'all');
rngOverall=range(data,'all');
data=(data-minOverall)/rngOverall;
Given earlier Comment caveat...

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by