Reputation: 5
I have a data of size 1000 * 500
I want to put the data into 100 groups by partitioning the rows into sizes of 10 I want to do something like:
for i = 1 : 100 %i = group
Group[i] = data(10*i : 10*i - 9, 1:500);
end
I'd like to know how I can do this without manually creating Group1,...Group100
Upvotes: 0
Views: 30
Reputation: 14937
Sounds like you want 3d arrays:
groups = permute(reshape(data, [10 100 500]), [1 3 2]);
Now groups(:, :, 1)
is a 10x500 matrix, group 1.
Upvotes: 2