필터 지우기
필터 지우기

Take row from a vector based on the value of another vector

조회 수: 3 (최근 30일)
Zair Ahmedi
Zair Ahmedi 2018년 7월 4일
댓글: Stephen23 2018년 7월 4일
For example, I have this column vector:
A =
0
5.1205
5.6338
0
2.9639
5.6774
0
2.6281
0.7772
2.5641
I want to remove other rows and take only rows where the index is from a vector
B =
2
3
5
6
8
9
10
So, it will become
C =
5.1205
5.6338
2.9639
5.6774
2.6281
0.7772
2.5641
  댓글 수: 1
Stephen23
Stephen23 2018년 7월 4일
Very basic MATLAB concepts, such as how to use indexing, are explained in the introductory tutorials. These are highly recommended for all beginners:

댓글을 달려면 로그인하십시오.

답변 (1개)

Robert U
Robert U 2018년 7월 4일
Hi Jerry,
Matlab documentation is your friend:
C = A(B)
Kind regards,
Robert

카테고리

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

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by