MATLAB: How to create cell in the loop

cell arrays

I create a struct each loop and want to use a cell to store these structs.I have no idea to implement the issue.
For example:
for I = 1:10
a = I;
b = I + 1;
tmpstruct = struct('a',a,'b',b);
% using cell to store the tmpstruct each loop
???
end
Assume the cell is CC.and I hope CC should be a 1*10 cell. Each element of CC is a struct. Any suggestion ?

Best Answer

CC = cell(1, 10);
for I = 1:10
a = I;
b = I + 1;
tmpstruct = struct('a',a,'b',b);
CC{I} = tmpstruct;
end
Related Question