Reshape a cell avoiding the loop
Afficher commentaires plus anciens
I have the cell for example:
a =
'0.0' '0.0'
'0.1' '-0.4'
'0.1' '0.8'
'0.2' '2.3'
'0.3' '3.4'
'0.3' '-3.2'
'0.4' '-6.9'
'0.5' '-1.8'
'0.5' '7.2'
'0.6' '10.0'
and I want o reshape it like this.
d =
'0.0' '0.0' '0.3' '-3.2'
'0.1' '-0.4' '0.4' '-6.9'
'0.1' '0.8' '0.5' '-1.8'
'0.2' '2.3' '0.5' '7.2'
'0.3' '3.4' '0.6' '10.0'
I want to avoid the loop because the cell dimensions are very large. Thank you!
Réponse acceptée
Plus de réponses (2)
the cyclist
le 11 Juin 2013
Modifié(e) : the cyclist
le 11 Juin 2013
d = [a(1:5,:),a(6:10,:)];
You can generalize this, of course, but you did not provide enough detail. If you always want the top half and bottom half, for example, you could use the size() command to determine the "height", and use half the height to determine the cutoff, which I just hard-coded as 5 here.
1 commentaire
Giorgos Papakonstantinou
le 11 Juin 2013
Giorgos Papakonstantinou
le 11 Juin 2013
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!