MATLAB: Need help for addition of cells

arraycell

Here is portion ofmy code
alto = cell(1, length(keysa));
for i = 1:length(keysa) % The for loop continues till number of Keys
alto{i} = note(keysa(i), dura(i)); function is called
end
treb = cell(1, length(keyst));
for i = 1:length(keyst)
treb{i} = note(keyst(i), durt(i)); % function is called
end
Now what i want is that to make a final cell array in which treb{i} and alto{i} are added and stored one by one i mean
final{1}= treb{1}+alto{1}
final {2}= treb{2} +alto{2}
so final is addition of both two.
I tried this one but gave error
final=cell(1,length(keyst)
for k=1:length(keyst)
final{i}=alto(i)+treb(i);
end

Best Answer

final=cell(1,length(keyst))
for k=1:length(keyst)
final{i}=alto{i}+treb{i};
end
Or
final = cellfun(@plus, alta, treb, 'Uniform', 0);