cell array of struct-Files

cell, matlab, struct

Solution

All you need to do is convert your `res2` from a cell array to a struct array (using `cell2mat`). Then you can get at the struct members in exactly the manner you desire. Here is an example, where `cdat` is a cell array of structs with two members, `s1` and `s2`.

cdat = 

    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]    [1x1 struct]

>> dat = cell2mat(cdat)

dat = 

1x10 struct array with fields:
    s1
    s2

>> [dat(:).s1]

ans =

     1     1     1     1     1     1     1     1     1     1

Problem

I have created a cell array of structure-files, like this for example: ``` >> res2 res2 = Columns 1 through 7 [1x1 struct] [1x1 struct] [1x1 struct] [1x1 struct] [1x1 struct] [1x1 struct] [1x1 struct] Columns 8 through 10 [1x1 struct] [1x1 struct] [1x1 struct] >> res2{1} ans = nchi005_randchi005: 0.1061 nfdr_randfdr: 0.0011 nlgt_randlgt: 2.9517e-004 nphast_randphast: 0.6660 ndd_rand_dd: 0.0020 ndd_rand_dd_larger: 1 >> res2{1}.nlgt_randlgt ans = 2.9517e-004 >> res{:}.nlgt_randlgt ??? Bad cell reference operation. ``` Is there a possiblity to access to all nlgt_randlgt-fields of res2-cellarray at once?

Original source