Reshape and Repmat neatly

Hi,
Can anyone help me Reshape and Replicate columns efficiently in MATLAB, I can do it with reshape and repmat but is extremely messy and i'm sure theres a quicker and neater way.
e.g.
A = [ a b c 1 2 3 4 5 6 7 8 9; d e f 1 2 3 4 5 6 7 8 9 ]
to
B = [ a b c 1 2 3; a b c 4 5 6; a b c 7 8 9; d e f 1 2 3; d e f 4 5 6; d e f 7 8 9; ]
Thanks

2 Kommentare

Walter Roberson
Walter Roberson am 15 Mär. 2012
Numbers and letters cannot be mixed in a numeric array.
Jan
Jan am 15 Mär. 2012
@Simon: It would easier to create an answer, if you use a numeric matrix with unqiue values.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sean de Wolski
Sean de Wolski am 15 Mär. 2012

1 Stimme

What is wrong with reshape and repmat? Reshape is extremely fast and some form of repmat is necessary since you want that much data at the end, i.e. you're not saving memory by avoiding rempat.

2 Kommentare

Jan
Jan am 15 Mär. 2012
Instead of REPMAT a ONES as index can be used. But this happens inside REPMAT also.
Geoff
Geoff am 15 Mär. 2012
Simon, if you are concerned about your solution being messy, why don't you post it? The community might be able to suggest a way to make it tidier.

Melden Sie sich an, um zu kommentieren.

Kategorien

Tags

Gefragt:

am 15 Mär. 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by