Remove duplicate values in matrix

22 ビュー (過去 30 日間)
thestargazer
thestargazer 2017 年 10 月 5 日
コメント済み: thestargazer 2017 年 10 月 5 日
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?

採用された回答

KL
KL 2017 年 10 月 5 日
編集済み: KL 2017 年 10 月 5 日
unique(a) %EDITED
  3 件のコメント
KL
KL 2017 年 10 月 5 日
Ah, Thanks Guillaume . Edited!
thestargazer
thestargazer 2017 年 10 月 5 日
Thanks!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by