フィルターのクリア

Merging Arrays in Ascending Order

30 ビュー (過去 30 日間)
Chris Dan
Chris Dan 2019 年 12 月 20 日
コメント済み: Chris Dan 2020 年 1 月 10 日
Hello, I am new to matlab. I have this problem. I have to merge two or more arrays into a new array in ascending order for example
The size of the new array will be equal to the sum of all the input arrays.
INPUT :
a = [1 2 3 5 6 8 9 ]
b = [4 7 10 15 17 20 ]
c = [11 12 13 14 16 18 19]
OUTPUT:
d = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20]
  5 件のコメント
Chris Dan
Chris Dan 2019 年 12 月 26 日
I have another problem,
If I am using a struct like this
talha4.JPG
How can I combine them, into 1 arary and then sort them in Ascending order?
BN
BN 2019 年 12 月 26 日
編集済み: BN 2019 年 12 月 26 日
Oh, this is a different question than the first one. If v is the name of your struct:
C = struct2cell(v)
then you can sort it using
Sort_C = sort(C)

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

採用された回答

BN
BN 2019 年 12 月 21 日
Hello my friend, I'm new too.
I guess you can use:
d = [a b c]
then sort:
d_sort = sort (d)
  3 件のコメント
Stephen23
Stephen23 2020 年 1 月 9 日
Chris Dan
Chris Dan 2020 年 1 月 10 日
hey,
I kind of solved it with uniquetal function

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

その他の回答 (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