필터 지우기
필터 지우기

select only one value every four (or different numbers) in an array

조회 수: 3 (최근 30일)
SYML2nd
SYML2nd 2021년 11월 29일
답변: Chunru 2021년 11월 29일
Hi,
I would like to select only one value every four in an array. For instance, given an array [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16], I obtain
[4 8 12 16]. Are there simple commands to do this?

채택된 답변

Chunru
Chunru 2021년 11월 29일
a = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]
a = 1×16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
b = a(4:4:16)
b = 1×4
4 8 12 16

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by