How do I convert a 5x4cell to a 5x4matrix?

In attachment is my example of the 5x4 cell. I want to create a 5x4 matrix of it. How do I do this?

Respuestas (2)

Luuk van Oosten
Luuk van Oosten el 6 de En. de 2015
Hi Sam, have you tried
M = cell2mat(C)

1 comentario

Sam
Sam el 6 de En. de 2015
Editada: Sam el 6 de En. de 2015
Yes, it doesn't work... "Error using cat Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 86) m = cat(2,m{:});"
Guillaume
Guillaume el 6 de En. de 2015

0 votos

Your 5x4 cell consists of vectors of different size totaling up 676 + 501 + ... + 358 = way more than 20 elements. A 5x4 matrix by definition only contains 20 elements.
In other words, what you want is not possible or you've not stated what you want correctly.

2 comentarios

Sam
Sam el 6 de En. de 2015
can I convert the 5x4cell to a 5x4struct?
Guillaume
Guillaume el 6 de En. de 2015
Editada: Guillaume el 6 de En. de 2015
You can:
s = struct('somefieldname', C);
The cell is probably easier to manipulate though.

La pregunta está cerrada.

Etiquetas

Preguntada:

Sam
el 6 de En. de 2015

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by