필터 지우기
필터 지우기

Selecting more than one range of elements of a vector with a single line code

조회 수: 29 (최근 30일)
Hello everyone,
i'm wondering if it's possible to select more than one range of elements of a vector with a single line code.
For example, given the vector a=[1,2,3,...,100], i'd like to select the two ranges [1,...,10] and [90,...,100]. I know that matlab allows to select only a continous range, e.g.:
a = 1:1:100;
b = a(1+89:100);
Thank you very much in advance.

채택된 답변

Bruno Luong
Bruno Luong 2018년 12월 8일
a([1:10, 90:100])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by