How to take each 10 rows and put it in different group

조회 수: 3 (최근 30일)
omar najjar
omar najjar 2021년 3월 4일
편집: Jan 2021년 3월 4일
I have a matrix with 2000*512 and I want to take each 10 othe rows and put it in a group. so total of 200 gorups each has 10 of my matrix
please I need a solution as soon as possible
  댓글 수: 1
Jan
Jan 2021년 3월 4일
편집: Jan 2021년 3월 4일
Remember that the answers are given by voluntary users in their sparetime. Then the term "as soon as possible" is not appropriate. Your question is not more urgent than the others.
You did not explain, what you call a "group". It would help to solve your problem, if you mention, what your goal is. A small example with a [6 x 3] matrix and 2 "groups" might be useful.

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

답변 (1개)

Jan
Jan 2021년 3월 4일
X = rand(2000, 512);
Y = reshape(X, 10, 200, 512);
% perhaps: Y = reshape(X, 200, 10, 512)?
% perhaps PERMUTE() such that the group index is the 3rd one?
Now you have an additional index for the group.
  댓글 수: 3
omar najjar
omar najjar 2021년 3월 4일
in this way for example y(1,:) is a one row with 5120 value which is not like what i want
Jan
Jan 2021년 3월 4일
You did not mention yet, what a "group" is.
A [200 x 10 x 512] array can be used as "group" using the first index as "group counter".
"in this way for example y(1,:) is a one row with 5120 value which is not like what i want"
y(1,:, :) is a [10 x 512] matrix.
Please do not explain, what you do not want, but define clearly, what you do want. The readers cannot guess this detail.

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

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by