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 visualización (últimos 30 días)
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 comentario
dpb
dpb el 28 de Feb. de 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.

Iniciar sesión para comentar.

Respuestas (1)

dpb
dpb el 28 de Feb. de 2021
data =xlsread('***');
minOverall=min(data,[],'all');
rngOverall=range(data,'all');
data=(data-minOverall)/rngOverall;
Given earlier Comment caveat...

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by