How to partition a data set.

16 次查看(过去 30 天)
Silpa K
Silpa K 2020-3-11
How can I partition a data set into a specified number of partition. I need to divide my data as 6 partition. I used
subds = partition(ds,n,index). How can I do that?
Please help me.

回答(1 个)

Raunak Gupta
Raunak Gupta 2020-3-19
Hi,
I assume you have dataset in some file format that can be read by any of the datastore mentioned here. The partition function will return a partition of that datastore with is indexed by variable idx. For example, the datastore has 36 files and you want to partition it into 6 datastore, so each partition will have 6 files. Each partition can be called with the help of index. Below example can clarify further.
% Let's say ds is the datastore with 36 files
subds1 = partition(ds,6,1); % contains files 1-6
subds2 = partition(ds,6,2); % contains files 7-12
subds3 = partition(ds,6,3); % contains files 13-18
subds4 = partition(ds,6,4); % contains files 19-24
subds5 = partition(ds,6,5); % contains files 25-30
subds6 = partition(ds,6,6); % contains files 31-36
Hope it helps!

类别

Help CenterFile Exchange 中查找有关 Datastore 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by