Finding elements according to indices from an array

조회 수: 18 (최근 30일)
Md. Asadujjaman
Md. Asadujjaman 2022년 1월 17일
답변: Image Analyst 2022년 1월 17일
Suppose,
x=[11 13 10 16 15 19 12 18 17 14]
y=[1 2 5 7 10]
I want to find the elements according to the indices presented in y.
The answer would be
[11 13 15 12 14]

채택된 답변

Image Analyst
Image Analyst 2022년 1월 17일
x=[11 13 10 16 15 19 12 18 17 14];
y=[1 2 5 7 10];
theAnswer = x(y)
theAnswer = 1×5
11 13 15 12 14
Try looking at this:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by