how to make a single array out of 2 arrays

6 ビュー (過去 30 日間)
michael
michael 2023 年 7 月 21 日
コメント済み: michael 2023 年 7 月 21 日
hi good day, i have given two arrays (odd and even), how can i make it as a one array such that the position of the elements in odd will be in odd and the same for the even array for the new array, thank you in advance
odd=[0.4357, 0.78208,0.6245]
even=[0.48004,1.29188,1.54668,0.82376]

採用された回答

James Tursa
James Tursa 2023 年 7 月 21 日
Just use indexing. E.g.,
odd=[0.4357, 0.78208,0.6245]
odd = 1×3
0.4357 0.7821 0.6245
even=[0.48004,1.29188,1.54668,0.82376]
even = 1×4
0.4800 1.2919 1.5467 0.8238
both(1:2:5) = odd
both = 1×5
0.4357 0 0.7821 0 0.6245
both(2:2:8) = even
both = 1×8
0.4357 0.4800 0.7821 1.2919 0.6245 1.5467 0 0.8238
But for your example the mesh doesn't cover all elements.
  1 件のコメント
michael
michael 2023 年 7 月 21 日
got it! thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by