how to repeat [5,4,3,2,1.....] infinitely?
3 ビュー (過去 30 日間)
古いコメントを表示
how could I?
can someone give me a code?
1 件のコメント
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
2022 年 3 月 31 日
編集済み: Bruno Luong
2022 年 3 月 31 日
A meta-array:
x = rep5to1(100:120)
%%
function x = rep5to1(i)
a=5:-1:1;
x = a(mod(i-1,length(a))+1);
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!