how to repeat [5,4,3,2,1.....] infinitely?
4 次查看(过去 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!