How to unpack contents of a cell array?

86 vues (au cours des 30 derniers jours)
Elissa
Elissa le 25 Avr 2018
Modifié(e) : Stephen23 le 23 Fév 2022

I have a cell array:

I try to unpack the contents of each cell:

h = size(dom_psth_tb,1);
dom_psth_tb = dom_psth_tb{1:h,1};    

But the result is the contents of only one cell:

Help is much appreciated!

Réponse acceptée

Stephen23
Stephen23 le 25 Avr 2018
Modifié(e) : Stephen23 le 23 Fév 2022
You can use a comma-separated list, and simply concatenate the contents into one matrix:
mat = vertcat(dom_psth_tb{:})
Read this to know more about comma-separated lists:
  2 commentaires
Elissa
Elissa le 25 Avr 2018
Thank you!
David Walwark
David Walwark le 8 Août 2018
The simple solution we all knew existed, thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Types 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