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 CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by