MATLAB: How to append a row of NaN to end of cell matrices

appendcellfunnan

If I have cells containing multiple polygons, how can I add a row of NaN to end of each polygon matrix so that,
A = {[1,2; 3,2; 3,3; 1,3],[4,5; 8,5; 8,8; 4,8]}
will turn to
A = {[1,2; 3,2; 3,3; 1,3; NaN,NaN],[4,5; 8,5; 8,8; 4,8; NaN,NaN]}

Best Answer

cellfun(@(x)[x;nan(1,2)],A,'un',0)