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

2 visualizzazioni (ultimi 30 giorni)
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".

Risposta accettata

the cyclist
the cyclist il 3 Gen 2018
new_list = list(a,:);
  2 Commenti
Miguel Reina
Miguel Reina il 3 Gen 2018
perfect! thank you so much. i was using instead and was not working.
new_list = list{a,:};
Stephen23
Stephen23 il 3 Gen 2018
Modificato: Stephen23 il 3 Gen 2018
@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:

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Cell Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by