フィルターのクリア

how to repeat [5,4,3,2,1.....] infinitely?

4 ビュー (過去 30 日間)
우재 민
우재 민 2022 年 3 月 31 日
編集済み: Bruno Luong 2022 年 3 月 31 日
how could I?
can someone give me a code?
  1 件のコメント
Rik
Rik 2022 年 3 月 31 日
Your computer does not have infinite memory. What exactly did you intend to do with this infinite vector?

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

回答 (1 件)

Bruno Luong
Bruno Luong 2022 年 3 月 31 日
編集済み: Bruno Luong 2022 年 3 月 31 日
A meta-array:
x = rep5to1(100:120)
x = 1×21
1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1
%%
function x = rep5to1(i)
a=5:-1:1;
x = a(mod(i-1,length(a))+1);
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by