How do I get to repeat the below vector one behind another like a train for a fixed interval

3 ビュー (過去 30 日間)
Yogesh
Yogesh 2024 年 2 月 28 日
回答済み: Shreeya 2024 年 2 月 28 日
EL=El_s.*exp(1i*phi);
I have previously defined this vector for (1 x 10000) length.
But I need to make this vector repeat like a train for 20 times.
Thank you!..

回答 (1 件)

Shreeya
Shreeya 2024 年 2 月 28 日
You can refer to the example code below which concatenates the temp array for 10 times. The parameters can be tuned for your use case accordingly.
N = 10; % Times to repeat
L = 3; % Size of the array which needs to be repeated
EL = zeros(1,N*3); % Prellocation for performance
temp = [1,2,3]; % Array which needs to be repeated
for i = 1:L:L*N
EL(i:i+L-1) = temp;
end

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by