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?

 Akzeptierte Antwort

KL
KL am 5 Okt. 2017
Bearbeitet: KL am 5 Okt. 2017

0 Stimmen

unique(a) %EDITED

3 Kommentare

Guillaume
Guillaume am 5 Okt. 2017
unique already return the values sorted (unless the 'stable' option is used), so the sort is redundant.
KL
KL am 5 Okt. 2017
Ah, Thanks Guillaume . Edited!
thestargazer
thestargazer am 5 Okt. 2017
Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Operators and Elementary Operations finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by