필터 지우기
필터 지우기

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 CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by