How can I divide a data set in to small data sets of equal length

I have a data set 'A' of 50000 samples (sampling time 1e-4sec) and want to divide this data set into small data sets, each small data set having 100 samples. And then have them in the form such as; A1, A2, A3, ....A500, so that I can use them further. (the small data sets are in a sequence such as A1= A(1:100), A2=A(101:200), A3=A(201:300), ..... A500)
I Will be grateful for kind help.

 Accepted Answer

Read about reshape
A = rand( 50000 ,1) ;
B = reshape(A,100,[]) ;

3 Comments

Thanks for guiding, I have read a bit and applied
A=Data(1:50000);
B=reshape(A,[100,500];
So the result is that
A 50000x1 double
becomes
B 100x500 double
I am a basic user of Matlab, could you please further tell, how I can have this in the form of separate 500 data sets with certain assigned names etc (as I mentioned in my main question) so that I can use/access them (all sub-sets or any selection I need)
YOu need not assign a different name to each data.....you can access them by using the matrix indexing.
B(:,1) % this gives B1
B(:,7) % this gives B7
Great, its working so well and simplified approach, thanks a lot for your help :)

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Asked:

on 27 Sep 2018

Commented:

on 27 Sep 2018

Community Treasure Hunt

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

Start Hunting!