Split array into equal parts

조회 수: 236 (최근 30일)
Kev Nash
Kev Nash 2021년 2월 15일
댓글: Kev Nash 2021년 2월 16일
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?

답변 (1개)

James Tursa
James Tursa 2021년 2월 15일
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
Kev Nash
Kev Nash 2021년 2월 16일
Works! Thank you!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by