Cell2mat - creating a matrix from mismatched cell sizes
Afficher commentaires plus anciens
Does anyone know how to create a matrix from a cell array where some of the cells have different lengths? Basically my instrument got interrupted when writing it's output file and finished halfway through a line. I don't want to discard the file as it's 99% complete. Is there another command which selectively converts a given sample size of a cell?
4 commentaires
Cedric
le 16 Jan 2013
What is the structure of your data (cell array, valid cells content, invalid cells content)?
Karen Hornsby
le 17 Jan 2013
Matt J
le 17 Jan 2013
If your data is initially acquired as a file, how did it get into cell array form? Why would you import the file to a cell array if you ultimately want it to be a vector?
Samira Abedi
le 2 Jan 2019
I get the following error when applying the above code:
Attempt to grow array along ambiguous dimension.
Réponse acceptée
Plus de réponses (2)
Jan
le 17 Jan 2013
What do you want as output for:
C = {[], 1, 1:2}
?
2 commentaires
Karen Hornsby
le 17 Jan 2013
Jan
le 17 Jan 2013
No, "C" is a cell, which contains vectors of different length. Simply copy it to the command window and run it. It is exactly what you have explained by:
... a cell array where some of the cells have different lengths?
Now you ask us for creating a matrix from such an input. So how should the output look like in this case?
Samira Abedi
le 2 Jan 2019
0 votes
I get the following error when I apply the suggested method:
Attempt to grow array along ambiguous dimension.
Catégories
En savoir plus sur Time Series Events dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!