How to create a cell array from rows of an existing cell array?

3 次查看(过去 30 天)
I have a cell array named "list" of 900 rows and 9 columns, each element of the cell array contains a string. i want to extract few rows of "list" to create a new cell array. The rows that i need are stored in a vector named "a".

采纳的回答

the cyclist
the cyclist 2018-1-3
new_list = list(a,:);
  2 个评论
Miguel Reina
Miguel Reina 2018-1-3
perfect! thank you so much. i was using instead and was not working.
new_list = list{a,:};
Stephen23
Stephen23 2018-1-3
编辑:Stephen23 2018-1-3
@Miguel Reina: the difference is simple:
  • {} curly braces refer to the cell contents.
  • () parentheses refer to the cells themselves.
Because you wanted to get a subset of the cell array, all you need is to use parentheses to refer to the cells themselves. Read more in the MATLAB documentation:

请先登录,再进行评论。

更多回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by