MATRIX MANUPULATION

1 visualizzazione (ultimi 30 giorni)
ofdma_matlab
ofdma_matlab il 9 Lug 2011
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

Risposte (1)

the cyclist
the cyclist il 9 Lug 2011
a_t = a';
b_t = reshape(a_t,2,6);
b = b';
  2 Commenti
Oleg Komarov
Oleg Komarov il 9 Lug 2011
one liner: b = reshape(a.',2,[]).';
Fangjun Jiang
Fangjun Jiang il 9 Lug 2011
Golfer: b=reshape(a',2,[])'

Accedi per commentare.

Categorie

Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by