Is it possible to change the size of a cell in a cell array?

4 vues (au cours des 30 derniers jours)
rahul allam
rahul allam le 31 Août 2015
Commenté : Image Analyst le 31 Août 2015
If yes; then how do i do it?I created a cell array of dimensions (128,1) and the size of each cell is(4,1) as of now which i will have to change for getting an appropriate result. It would really feel to use some help.Thank you.
  1 commentaire
Image Analyst
Image Analyst le 31 Août 2015
You can stuff whatever you want into a cell and it blows away what used to be in there. What's the data type? Are all cells going to be the same size? If so, and they're numbers, why not just use a regular 2D matrix? Or if they're different sizes, a structure array? Are there going to be strings in the cells?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 31 Août 2015
... Yes?
X = repmat({1, 2, 3, 4}, 128, 1);
X is now a cell array of length 128 that contains cells that are 1 x 4 numeric.
You can now say
X{42} = {1, 2, 3, 3.1, 3.14, 3.141, 3.1415};
and now X{42} will be a cell that contains 1 x 7 numeric.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by