How is it possible to get new matrix with some values of another matrix?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Aleksandrs Sergijenko
il 27 Apr 2018
Commentato: Aleksandrs Sergijenko
il 27 Apr 2018
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.
0 Commenti
Risposta accettata
Siyu Guo
il 27 Apr 2018
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).
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!