Converting cell arrays back to matrix

1 vue (au cours des 30 derniers jours)
Stewart Tan
Stewart Tan le 7 Août 2019
So i have a matrix:
my_mat = [10 5 6; 2 4 8; 1 20 50]
and i used the function 'num2cell' to convert the matrix above into a cell array
mat_cell = num2cell(my_mat)
which becomes:
{[ 10]} {[ 5]} {[ 6]}
{[ 2]} {[ 4]} {[ 8]}
{[ 1]} {[ 20]} {[ 50]}
but the problem I'm facing now is that i want to convert the cell array back to matrix so that i would get:
10 5 6
2 4 8
1 20 50
but i looked up on other post mentioning to use:
new_mat = [mat_cell{:}]
but I'm getting it in the form
1 2 10 20 4 5 50 8 6
Can anyone show me how i would get back the matrix form?

Réponses (1)

madhan ravi
madhan ravi le 7 Août 2019
cell2mat(mat_cell)

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by