how to repeat [5,4,3,2,1.....] infinitely?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
how could I?
can someone give me a code?
1 Commento
Rik
il 31 Mar 2022
Your computer does not have infinite memory. What exactly did you intend to do with this infinite vector?
Risposte (1)
Bruno Luong
il 31 Mar 2022
Modificato: Bruno Luong
il 31 Mar 2022
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 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!