I have a function that returns arrays of struct arrays. I want to call this function repeatedly, appending the returned value to another array, but I'd like to append the returned value as a single element of the larger array. cat() doesn't seem to work for me because it appends every element of the returned value individually to the larger array.
In the context of the following example, how do I add foo to bar as a single element of bar?
foo(1).id = 1;
foo(1).v = 'a';
foo(2).id = 2;
foo(2).v = 'b';
bar = [];
bar = cat(1, bar, foo); % Adds each element of foo individually