Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
merge values in matrix

Subject: merge values in matrix

From: ian johnston

Date: 10 Oct, 2010 21:21:03

Message: 1 of 2

hey guys,

I have a matrix :

Coordinates =

                    62.875 10 63.617 31
                     75.45 55 66.725 61
                     65.23 32 11.444 76
                    68.077 63 74.936 134

I'd like to merge them as:

Merged =
                    62.875 10 66.725 61
                    65.23 32 74.936 134

That is, merge every 2 rows as follows: the first 2 values in the 1st row and the last 2
                                                        values in the 2nd row.

Some help would be appreciated?

Ian

Subject: merge values in matrix

From: Roger Stafford

Date: 10 Oct, 2010 21:46:03

Message: 2 of 2

"ian johnston" <iano1213@gmail.com> wrote in message <i8tanv$73p$1@fred.mathworks.com>...
> hey guys,
>
> I have a matrix :
>
> Coordinates =
>
> 62.875 10 63.617 31
> 75.45 55 66.725 61
> 65.23 32 11.444 76
> 68.077 63 74.936 134
>
> I'd like to merge them as:
>
> Merged =
> 62.875 10 66.725 61
> 65.23 32 74.936 134
>
> That is, merge every 2 rows as follows: the first 2 values in the 1st row and the last 2
> values in the 2nd row.
>
> Some help would be appreciated?
>
> Ian
- - - - - - - -
 M = [C(1:2:2*floor(end/2),1:2),C(2:2:2*floor(end/2),end-1:end)];

where C is the Coordinates array and M is Merged.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

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.

Contact us