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

1 回表示 (過去 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 Center および File ExchangeLogical についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by