Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: how to split a matrix
Replies: 2   Last Post: Mar 16, 2013 9:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Steven Lord

Posts: 17,945
Registered: 12/7/04
Re: how to split a matrix
Posted: Mar 7, 2013 10:28 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Timothy Koh" <timothy_koh87@hotmail.com> wrote in message
> "James Tursa" wrote in message <kh9fap$h62$1@newscl01ah.mathworks.com>...
>> "Timothy Koh" <timothy_koh87@hotmail.com> wrote in message
>> <kh9eo1$fmj$1@newscl01ah.mathworks.com>...

>> > 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,

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

See functions like RESHAPE, COLON, and RANDPERM for some of the tools that
may be useful to you depending on your chosen division method.

Steve Lord
To contact Technical Support use the Contact Us link on

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.