필터 지우기
필터 지우기

I want to generate the series [2,3, 6,7, 10,11,.....] i.e plotting first two consecutive numbers and ignoring nest two consecutive numbers and so on... any idea?

조회 수: 1 (최근 30일)
I want to generate the series [2,3, 6,7, 10, 11, 14,15,.......] that is, plotting two conscutive natural numbers, then ignoring the nest two consecutive natural numbers and so on. Any help will be appreciated

답변 (1개)

Voss
Voss 2022년 7월 24일
편집: Voss 2022년 7월 24일
n_start = 2;
n_end = 100;
One way:
n = n_start:n_end;
n(3:4:end) = [];
n(3:3:end) = [];
n
n = 1×50
2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 34 35 38 39 42 43 46 47 50 51 54 55 58 59
Another way:
n = reshape((n_start:4:n_end)+[0; 1],1,[])
n = 1×50
2 3 6 7 10 11 14 15 18 19 22 23 26 27 30 31 34 35 38 39 42 43 46 47 50 51 54 55 58 59

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by