MATRIX MANUPULATION

suppose i have a matrix like this, a = [ 1 2 3 4; 5 6 7 8; 9 10 11 12] i want it like b = [1 2; 3 4; 5 6; 7 8; 9 10; 11 12 ] any idea ? thanks in advance

Antworten (1)

the cyclist
the cyclist am 9 Jul. 2011

0 Stimmen

a_t = a';
b_t = reshape(a_t,2,6);
b = b';

2 Kommentare

Oleg Komarov
Oleg Komarov am 9 Jul. 2011
one liner: b = reshape(a.',2,[]).';
Fangjun Jiang
Fangjun Jiang am 9 Jul. 2011
Golfer: b=reshape(a',2,[])'

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Types finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 9 Jul. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by