Convert cell of matrix into one matrix

2 vues (au cours des 30 derniers jours)
Alejandro Fernández
Alejandro Fernández le 28 Jan 2021
Commenté : Fangjun Jiang le 28 Jan 2021
Hi, does someone know how can I convert cell A into matrix B as the exameple bellow?
% Where A is:
A{1} = [1 2 3;4 5 6];
A{2} = [7 8 9;10 11 12;13 14 15];
% And B should be:
B = [1 2 3
4 5 6
7 8 9
10 11 12
13 14 15];
Thank you so much for all your help.

Réponse acceptée

madhan ravi
madhan ravi le 28 Jan 2021
B = cat(1, A{:})
  1 commentaire
Alejandro Fernández
Alejandro Fernández le 28 Jan 2021
It's perfect! Thank you so much!!!

Connectez-vous pour commenter.

Plus de réponses (1)

Fangjun Jiang
Fangjun Jiang le 28 Jan 2021
cell2mat()
  2 commentaires
Alejandro Fernández
Alejandro Fernández le 28 Jan 2021
You may have seen it before I edited the response. I had posted an example that wasn't the right one.
Fangjun Jiang
Fangjun Jiang le 28 Jan 2021
It's a matter of cell2mat(A) or cell2mat(A'). It's better to follow a tip to learn something on your own than getting a direct answer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Type Conversion dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by