Reshaping nested struct arrays to cell array having elements with different sizes
问题 I have a similar question to my previous one. This time the form of the nested structure looks like this: Sizes = [2, 5, 8, 6, 3]; cells = 5; for i = 1:cells for j = 1:Sizes(i) a(i).b.c(j).d = rand(1,1); end a(i).b.Size = Sizes(i); end Again I would like to put all the d values of a(:).b.c(:) into a single cell array that contains 1 x cells cells. Here is my solution using cellfun but I would like to avoid this function: ab = [a.b]; abc = {ab.c}; abcd = cellfun(@(x) [x.d], abc, 'UniformOutput