Thread Subject: combine matrices of different lengths

Subject: combine matrices of different lengths

From: Rachel

Date: 9 Feb, 2010 10:01:02

Message: 1 of 3

I have two matrices, one of which is data taken at 1 hz, the other which is taken at 64hz, and neither of them have anything in common except for they start at the same time and end at the same time (only one actually HAS time)

I need two elements from the shorter file for each of the records in the longer file and so far my thinking is basic: copy each row 64 times and then join the matrices. simple. except for i can't think of a way to do it quickly.

has anyone got any ideas, or preferably solutions?

The 64 hz file is full of velocity values, the 1 hz file has the pitch and roll information of the experiment.

thanks in advance

Rachel

Subject: combine matrices of different lengths

From: Ashish Uthama

Date: 9 Feb, 2010 13:33:35

Message: 2 of 3

On Tue, 09 Feb 2010 05:01:02 -0500, Rachel <rhnaeco@geemale.com> wrote:

> I have two matrices, one of which is data taken at 1 hz, the other which
> is taken at 64hz, and neither of them have anything in common except for
> they start at the same time and end at the same time (only one actually
> HAS time)
>
> I need two elements from the shorter file for each of the records in the
> longer file and so far my thinking is basic: copy each row 64 times and
> then join the matrices. simple. except for i can't think of a way to do
> it quickly.
>
> has anyone got any ideas, or preferably solutions?
>
> The 64 hz file is full of velocity values, the 1 hz file has the pitch
> and roll information of the experiment.
>
> thanks in advance
>
> Rachel

Something like this?


>> singles=1:5

singles =

      1 2 3 4 5

>> reps=repmat(singles,[4,1])

reps =

      1 2 3 4 5
      1 2 3 4 5
      1 2 3 4 5
      1 2 3 4 5

>> mults=reps(:)'

mults =

   Columns 1 through 13

      1 1 1 1 2 2 2 2 3 3 3
3 4

   Columns 14 through 20

      4 4 4 5 5 5 5

Subject: combine matrices of different lengths

From: Rachel

Date: 12 Feb, 2010 10:53:03

Message: 3 of 3

yes! thanks
"Ashish Uthama" <first.last@mathworks.com> wrote in message <op.u7u3x9c1a5ziv5@uthamaa.dhcp.mathworks.com>...
> On Tue, 09 Feb 2010 05:01:02 -0500, Rachel <rhnaeco@geemale.com> wrote:
>
> > I have two matrices, one of which is data taken at 1 hz, the other which
> > is taken at 64hz, and neither of them have anything in common except for
> > they start at the same time and end at the same time (only one actually
> > HAS time)
> >
> > I need two elements from the shorter file for each of the records in the
> > longer file and so far my thinking is basic: copy each row 64 times and
> > then join the matrices. simple. except for i can't think of a way to do
> > it quickly.
> >
> > has anyone got any ideas, or preferably solutions?
> >
> > The 64 hz file is full of velocity values, the 1 hz file has the pitch
> > and roll information of the experiment.
> >
> > thanks in advance
> >
> > Rachel
>
> Something like this?
>
>
> >> singles=1:5
>
> singles =
>
> 1 2 3 4 5
>
> >> reps=repmat(singles,[4,1])
>
> reps =
>
> 1 2 3 4 5
> 1 2 3 4 5
> 1 2 3 4 5
> 1 2 3 4 5
>
> >> mults=reps(:)'
>
> mults =
>
> Columns 1 through 13
>
> 1 1 1 1 2 2 2 2 3 3 3
> 3 4
>
> Columns 14 through 20
>
> 4 4 4 5 5 5 5

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com