Imagine a cell array that consists of identical structs (in terms of layout), as the example cellArray below. How can I apply cellfun to a specific field of these structs?
cellArray{1,1}.val1 = 10;
cellArray{1,1}.val2 = 20;
cellArray{1,2}.val1 = 1000;
cellArray{1,2}.val2 = 2000;
How to use cellfun in order to add the value 50 to all cells, but only to the field val2?
out = cellfun(@plus, cellArray?????, {50, 50}, 'UniformOutput', false);