How to unpack contents of a cell array?

98 views (last 30 days)

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!

Accepted Answer

Stephen23
Stephen23 on 25 Apr 2018
Edited: Stephen23 on 23 Feb 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 Comments
David Walwark
David Walwark on 8 Aug 2018
The simple solution we all knew existed, thank you.

Sign in to comment.

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!