"Timothy Koh" <firstname.lastname@example.org> wrote in message news:email@example.com... > "James Tursa" wrote in message <firstname.lastname@example.org>... >> "Timothy Koh" <email@example.com> wrote in message >> <firstname.lastname@example.org>... >> > Hi >> > >> > I have a <39014400x1 double> matrix. How do i go about splitting it and >> > merge it back together? >> > >> > Help is greatly appreciated >> > >> > Regards >> > Timothy >> >> How do you want it split? E.g., >> >> a = rand(39014400,1); >> b = a(1:1000000); % split first part >> c = a(1000001:end); % split second part >> d = [b;c]; % join the pieces back together >> >> James Tursa > > Thanks James Tursa. Is it possible to split it like into number of > segments i want? Eg. splitting it into 20 segments.
You haven't given the group sufficient information to answer definitively, but I suspect the answer is yes. What limitations do you have on which element goes into which segment?
First 39014400/20 elements in segment 1, next 39014400/20 elements in segment 2, etc.?
Elements 1:20:39014400 in segment 1, elements 2:20:39014400 in segment 2, etc.?
Elements 1 through 19 in segments 1 through 19 respectively and the rest in segment 20?
Segments 1 through 19 each contain 1% of the data set chosen (without replacement) at random, segment 20 contains the rest? [A division like this might be useful in training/validation set division for neural network training.]
See functions like RESHAPE, COLON, and RANDPERM for some of the tools that may be useful to you depending on your chosen division method.