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

3 Ansichten (letzte 30 Tage)
omar najjar
omar najjar am 4 Mär. 2021
Bearbeitet: Jan am 4 Mär. 2021
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 Kommentar
Jan
Jan am 4 Mär. 2021
Bearbeitet: Jan am 4 Mär. 2021
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jan
Jan am 4 Mär. 2021
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 Kommentare
omar najjar
omar najjar am 4 Mär. 2021
in this way for example y(1,:) is a one row with 5120 value which is not like what i want
Jan
Jan am 4 Mär. 2021
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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by