Is there a simple way to create an up down counter in command line or simple script/function?
Specifically, how can we create vectors such as [...1 2 3 3 2 1 1 2 3...], and more generally for any integers instead of 1 and 3?

답변 (1개)

darova
darova 2020년 3월 9일

0 개 추천

Example
n = 3;
sample = [1:n flip(1:n)];
vector = repmat(sample,[1 3]);

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2020년 3월 9일

답변:

2020년 3월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by