Split array into equal parts

53 vues (au cours des 30 derniers jours)
Kev Nash
Kev Nash le 15 Fév 2021
Commenté : Kev Nash le 16 Fév 2021
I have a matrix A of size 1x816.
I need to split into 1x8 matrices in this way:
1:8
9:16
17:24 and so on..up to 816.
What is the best way to do so?

Réponses (1)

James Tursa
James Tursa le 15 Fév 2021
You could reshape it and then access by columns. E.g.,
R = reshape(A,8,[]);
Then A(:,1) is the first 8 values, A(:,2) is the second 8 values, etc.
  1 commentaire
Kev Nash
Kev Nash le 16 Fév 2021
Works! Thank you!

Connectez-vous pour commenter.

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by