MATLAB: For/If loop in cell array

cell arrayfor loopif loop

Hi,
I have a question regarding implementing a for and if loop with cell arrays.
I have a matrix A{1×24 cell} Each cell contains ages of people, but each cell has a different length (i.e. A{1} is 2362×1, while A{2} is 2344×1, etc.).
Now I want to apply an if loop that for each value in A which is >=1, that specific value will be subtracted by 1.
Can anyone help me with this?

Best Answer

Some fake data to try, and the loop:
A{3} = 2:5;
A{2} = -3:4;
A{1} = -2:2;
for k = 1:numel(A)
idx = A{k}>=1;
A{k}(idx) = A{k}(idx) - 1;
end