Hello everyone. I have a question.
I have an array which has 500 elements such as A = [1,2,3,4,5,6,7...500]
And I want to copy last values of the each dual arrays and add them after dual arrays like that --> B = [1,2,2,3,4,4,5,6,6,7,8,8,.....,500]
How can I do this?
Thanks..

 採用された回答

madhan ravi
madhan ravi 2019 年 2 月 13 日
編集済み: madhan ravi 2019 年 2 月 13 日

2 投票

A=1:500;
B=zeros(1,numel(A)+floor(numel(A)/2));
B(3:3:end)=A(2:2:end);
B(setdiff(1:numel(B),3:3:end))=A

2 件のコメント

OKG
OKG 2019 年 2 月 13 日
great! Thank you!
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 2 月 13 日
+1 Great

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCell Arrays についてさらに検索

質問済み:

OKG
2019 年 2 月 13 日

コメント済み:

2019 年 2 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by