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 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
dpb
il 28 Feb 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.
Risposte (1)
dpb
il 28 Feb 2021
data =xlsread('***');
minOverall=min(data,[],'all');
rngOverall=range(data,'all');
data=(data-minOverall)/rngOverall;
Given earlier Comment caveat...
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements 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!