How to combine cell arrays into a uniform one

14 vues (au cours des 30 derniers jours)
Ra Karamislo
Ra Karamislo le 4 Jan 2019
Hello!
Can anybody please help me with this problem:
I have a cell array 8×1. 1 column of 8 this {100×1 double} cells. And also I have another cell array 4×1. 1 column of 4 this {100×1 double} cells. I need to join them in one clumn of 12 cells. I would think the syntax it is similar to normal arrays like joint_array=[A;B].
I was trying different ways but the best result is 2×1 cell array
{8×1 cell}
{4×1 cell}
I need to smoosh it all into one box, to become 12×1 cell array. the data in cells is same type {100×1 double}
thank you.
  1 commentaire
per isakson
per isakson le 4 Jan 2019
Here we don't use # as leading characters in tags.

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 4 Jan 2019
Modifié(e) : madhan ravi le 4 Jan 2019
C = {{1:3},{3:5}} % an example data
C = vertcat(C{:}) % combined cell array as one
vertcat(C{:}) % concatenated again to convert as a double array

Plus de réponses (2)

KSSV
KSSV le 4 Jan 2019
Modifié(e) : KSSV le 4 Jan 2019
Read about cell2mat
C = cell(4,1) ;
C{1} = rand(10,1) ;
C{2} = rand(5,1) ;
C{3} = rand(2,1) ;
C{4} = rand(7,1) ;
iwant = cell2mat(C)

Ra Karamislo
Ra Karamislo le 4 Jan 2019
Thank you very much

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by