MATLAB >> How to rearrange a matrix upsidedown?

by khaluaa7 » Sat, 07 Feb 2004 07:44:44 GMT

Hello everyone,

I have a matrix made of 100 rows and 200 columns.
I want to reformat the matrix so that:

1-The 1st row which is on top of the matrix becomes the last row of
the matrix
2-The 100th row which is at the bottom of the matrix becomes the 1st
row of the matrix

In the sense that:
Old Matrix New Matrix

row 1 row 100
row 2 row 99
row 3 row 98
row ... ...
row 50 row 50
row ... ...
row 98 row 3
row 99 row 2
row 100 row 1

Could someone help me?

Thank you
Nuage

MATLAB >> How to rearrange a matrix upsidedown?

by ross woods » Sat, 07 Feb 2004 07:57:50 GMT


help flipud

ross

MATLAB >> How to rearrange a matrix upsidedown?

by khaluaa7 » Sat, 07 Feb 2004 11:57:54 GMT

Hi Ross

Thank you very much for your help ;-).


Nuage

MATLAB >> How to rearrange a matrix upsidedown?

by Jos » Mon, 09 Feb 2004 18:51:13 GMT


XXXX@XXXXX.COM (Nuage) wrote in



You can use vector-indexing

new = old(end:-1:1,:) ;

or take a look at the (slower) FLIPUD function.

Jos


--
Email: jnvdg AT arcor DOT de

MATLAB >> How to rearrange a matrix upsidedown?

by khaluaa7 » Tue, 10 Feb 2004 12:09:48 GMT

Hello Jos

How are you?
Thank you for your help.

What does the command means?
new file equal old final, start at the end(last row) and end at row 1,
with increment of minus 1 for all columns of that row at the same time
...?


Thank you
Nuage

MATLAB >> How to rearrange a matrix upsidedown?

by Jos » Tue, 10 Feb 2004 16:44:59 GMT


XXXX@XXXXX.COM (Nuage) wrote in



Hi Nuage,
you are right. I think it will help you a great deal to read some stuff on
matrix indexing in matlab (see for instance the help files).

Jos

--
Email: jnvdg AT arcor DOT de

Similar Threads

1. Rearranging 3D matrix

Hi This is probably very easy so please bear with me. I 
have a matrix M(b,c,a) but I need it to be rearranged as 
M(a,b,c). 

Thanks,
S

2. similarity matrix rearrange - MATLAB

3. Rearrange matrix

thank :)

4. How to randomly rearrange a matrix? - MATLAB

5. Matrix rearranging

Hi,

Supposing I have a matrix

a b c d e
f g h i j
k l m n o
p q r s t

I want to turn that into a matrix that's like

a b c d e f g h i j k l m n o p q r s t

so that i can plot it on a graph in a certain way.

I was wondering what the best way of doing this is... should I write
a for loop?

All the best,

Tom

6. matrix manipulation --row rearranging - MATLAB

7. How to rearrange matrix and vectors by scales?

In tomographic reconstruction, after applying 1-D orthonormal
multiscale wavelet transform to angle-ordered projection data, we get
multiscale representation of the data, which is also angle-ordered.
My question is how to arrange it by scales? That means all the finest
scale components of each angle are groups first, then the second
finest scale components, ...

8. rearrange equations to matrix form - MATLAB