I have a 221 x 24 cell array, S. Within each array is another array consisting of several different fields (let's just say A, B, C, and D), whereby each field (A, B, C, D) are a 50 x 50 array. I want to sum only the A's, B's, C's, and D's within each column of array S. For example:
S{1,1}.A + S{2,1}.A + ... + S{23,1}.A ...
S{1,2}.B + S{2,2}.B + ... + S{153,2}.B ...
S{111,3}.C + S{117,3}.C + ... + S{230,3}.C ...
What is the simplest way to do this? I know there is a function to sum if there are no fields within the structure (e.g., sum([S{:}]) ), but I only want the specific fields in each summed. Any thoughts?