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 Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by