Remap values of 256x256 array based on ranges
Afficher commentaires plus anciens
done like this
if (n_rounded>=-90.0) && (n_rounded<-67.5)
n_rounded=-90;
elseif (n_rounded>=67.5) && (n_rounded<90.0)
n_rounded=-90;
elseif (n_rounded>=-67.5) && (n_rounded<-22.5)
n_rounded=-45;
elseif (n_rounded>=-22.5) && (n_rounded<22.5)
n_rounded=0;
elseif (n_rounded>=22.5) && (n_rounded<67.5)
n_rounded=45;
end
getting error Operands to the and && operators must be convertible to logical scalar values.
1 commentaire
Réponse acceptée
Plus de réponses (1)
[~,~,bins]=histcounts(n_rounded,[-90,-67.5,-22.5,22.5, 67.5,90] );
targetValues=[-90,-45,0,45,-90];
n_rouned=targetValues(bins);
1 commentaire
Ram
le 22 Fév 2016
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!