how to repeat [5,4,3,2,1.....] infinitely?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
how could I?
can someone give me a code?
1 commentaire
Rik
le 31 Mar 2022
Your computer does not have infinite memory. What exactly did you intend to do with this infinite vector?
Réponses (1)
Bruno Luong
le 31 Mar 2022
Modifié(e) : Bruno Luong
le 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 commentaires
Voir également
Catégories
En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!