I want to merge structure fields in case I do partial computations, to later fill up the whole structure field cells.
The results are put into cells according to index into the cell, like this:
for i=3:4;
results1.index{i}=i;
results1.sqr{i}=i*i;
end
for i=1;
results2.index{i}=i;
results2.sqr{i}=i*i;
end
giving, respectively:
results1 =
index: {[] [] [3] [4]}
sqr: {[] [] [9] [16]}
results2 =
index: {[1]}
sqr: {[1]}
is there a way to merge the resulting structures to obtain
allresults.index={[1] [] [3] [4]}
allresults.sqr={[1] [] [9] [16]}
I can avoid overlapping results, so no conflict resolution or overwriting in case of conflicting values (e.g. none of the cells are empty) would be ok. Please note that in the larger dataset, cells are not limited to scalars but may contain cells or other types.