This was my first idea to join all the cells to one. I have an array with the handles of all my patch objects, then I determine the largest cell and run two for-loops. To make sure that a certain cell is not empty or has an entry at all I check if length(currentPatch) >= j and if iscell(currentPatch{j]). This cell now needs to be written into a file with fopen and fprintf() either with whitespace/ empty row between the "text blocks" (like I have shown in my question) or at once. I dont know how to put whitepace between these blocks
l = []
exportCell = {}
for i = 1:length(patch_array)
l = [l,length(patch_array(i).UserData)]
end
lmax = max(l)
for j = 3:lmax
for k = 1:length(patch_array)
currentPatch = app.patch_array(k).UserData
if length(currentPatch) >= j && iscell(currentPatch{j})
exportCell = [exportCell; currentPatch{j}]
end
end
end