Wednesday, May 23, 2018

Matlab reshape arrays with internal structures

I have an array like this:

    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}
    {1×2 cell}

But I want to turn it into a 10X2 array.

The way to do it is
[cellfun(@(x) x{1},array,'UniformOutput',false) cellfun(@(x) x{2},array,'UniformOutput',false)];

No comments:

Post a Comment