Effacer les filtres
Effacer les filtres

normalization cell array [1 -1]

2 vues (au cours des 30 derniers jours)
haitham qutaiba
haitham qutaiba le 19 Déc 2019
Commenté : haitham qutaiba le 19 Déc 2019
Dear all,
I have cell array called features got one row and four colunms,
features{1} = [-9 2 NaN 4 5 10];
features{2} = [2 -8.3 4 5 10];
features{3} = [8 NaN 10];
features{4} = [8 -4 9 9 2 1 3 10];
i would do normalization between 1 -1 based on this equation below, but this equation works with matrix not cell
features(:,1:end-1)=(features(:,1:end-1)-min(min(features(:,1:end-1))))/...
(max(max(features(:,1:end-1)))-min(min(features(:,1:end-1))));
i need a help how do normalization by ignoring last part of each cell which number 10 and NaN. and normolize it for the rest of numbers in cell.
thanks in advance.

Réponse acceptée

Nicolas B.
Nicolas B. le 19 Déc 2019
Modifié(e) : Nicolas B. le 19 Déc 2019
oh I see that you are mixing cell arrays and arrays. With your feature structure, to access the -9 of your first line, you need to do:
features{1}(1)
So, with your structure, if you want to continue that way, you should use this code:
% the normalisation function for 1 array
fnom = @(v) [(v(1:end-1) - min(v(1:end-1)))/(max(v(1:end-1))-min(v(1:end-1))), v(end)];
% apply your function on features cell array
features = cellfun(fnom, features, 'UniformOutput', false)
  1 commentaire
haitham qutaiba
haitham qutaiba le 19 Déc 2019
thank you so much Nicolas,

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by