필터 지우기
필터 지우기

How to put bounds and delete certain rows from a matrix.

조회 수: 2 (최근 30일)
Alice
Alice 2022년 9월 30일
댓글: Walter Roberson 2022년 9월 30일
No if/for/while statements

답변 (1개)

Walter Roberson
Walter Roberson 2022년 9월 30일
In MATLAB, if you use logical indexing to delete entries from an array, then the result you get is a column vector in linear indexing order.
If you are certain that the number of entries retained for each column is the same, then you can reshape() it according to the number of rows expected to remain.
For example,
10 52
20 62
30 72
40 82
then the in memory order of that would be [10 20 30 40 52 62 72 82] . Suppose we use logical indexing to delete the 30 and the 62, then the resulting in memory order of elements would be [10 20 40 52 72 82] . Reshape that to 3 rows and you would get
10 52
20 72
40 82
which would be the desired result.

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by