フィルターのクリア

Assigned small array values into Big array using for loops

3 ビュー (過去 30 日間)
Ankitkumar Patel
Ankitkumar Patel 2022 年 2 月 28 日
コメント済み: Ankitkumar Patel 2022 年 2 月 28 日
Size(per)=1*(multiple of 180) double; e.g. 1*720
Size(temp)=180*1 double
as of 720/180=4;
My goal is to assign temp values in per like these per(1:4)=temp(1); per(5:8)=temp(2), ...., per(717:720)=temp(180). How can I perfect second for loop??
for j=1:length(temp)
for i =1:length(per)/length(temp)
per(i)=temp(j);
end
end

採用された回答

Stephen23
Stephen23 2022 年 2 月 28 日
編集済み: Stephen23 2022 年 2 月 28 日
per = repelem(temp,4)
Or if it is required to use some indexing:
per(:) = repelem(temp,4)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by