Remove duplicate values in matrix

28 vues (au cours des 30 derniers jours)
thestargazer
thestargazer le 5 Oct 2017
Commenté : thestargazer le 5 Oct 2017
Hi, I have following code:
a_x = 1.5:0.2:a_max;
a_y = 1.5:0.2:a_max;
a = zeros(length(a_x),length(a_y));
for i = 1:length(a_x)
for j = 1:length(a_y)
a(j,i) = (a_x(i)+a_y(j))/2;
end
end
I would like to remove all duplicate values in a, and turn this in a vector with ascending value. Any idea how?

Réponse acceptée

KL
KL le 5 Oct 2017
Modifié(e) : KL le 5 Oct 2017
unique(a) %EDITED
  3 commentaires
KL
KL le 5 Oct 2017
Ah, Thanks Guillaume . Edited!
thestargazer
thestargazer le 5 Oct 2017
Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting 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