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

4 次查看(过去 30 天)
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 个评论
Image Analyst
Image Analyst 2015-8-31
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?

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2015-8-31
... 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.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by