How to partition a data set.

40 views (last 30 days)
Silpa K
Silpa K on 11 Mar 2020
Answered: Raunak Gupta on 19 Mar 2020
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.

Answers (1)

Raunak Gupta
Raunak Gupta on 19 Mar 2020
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!

Community Treasure Hunt

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

Start Hunting!