How to replace every other element in an array with another array?

6 ビュー (過去 30 日間)
Thomas Holmes
Thomas Holmes 2019 年 2 月 27 日
回答済み: madhan ravi 2019 年 2 月 27 日
I have an array A, which is just 1 row and 98 columns of zeros. I need to replace every other number with another array which is 1x49. So, A(1)=B(1), A(3)=B(2), A(5)=B(3) and so forth until A(97)=B(49). I have tried using an index to replace the odd indexes of A with the values of B, using two for loops which span over each array. This resulted in it replacing all the odd entries with each entry of B at a time so at the end it just replaced it with the last entry of B.

採用された回答

madhan ravi
madhan ravi 2019 年 2 月 27 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by