필터 지우기
필터 지우기

How is it possible to get new matrix with some values of another matrix?

조회 수: 2 (최근 30일)
Hello, i'v got table(matrix) S with 907x1280 elements in array, what script should i write to get, for example, all values in columns from 200 till 700 with step 25, every 25 row. All new data should be in the new matrix.

채택된 답변

Siyu Guo
Siyu Guo 2018년 4월 27일
This is the very elementary array index operation. To retrieve the specified data, just use
S(:, 200:25:700)
If you'd like the retrieved columns to form a new matrix by their relative positions in S, simply code
A = S(:, 200:25:700)
A is an m-by-201 matrix, m being the number of rows of S. If you'd like to assign the extracted data to a portion of a new matrix, make sure that the destination portion can also be arranged as an m-by-201 matrix, e.g.,
A(3:m+2, 5:2:405) = S(:, 200:25:700)
A being the already allocated new matrix (hope I haven't made mistakes).

추가 답변 (0개)

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by