MATLAB: Replace value from cell from particular index

cellmat2cellMATLABmatrixsubmatrix

I got two 3 x 3 sub-matrix from mat2cell
cell1=[1 1 1; 1 1 1; 1 1 1];
cell2=[0 0 0; 0 0 0; 0 0 0];
i want to replace value from cell1 index (2,2) with cell2 index(2,2)
cellresult=[1 1 1; 1 0 1; 1 1 1];
Thanks

Best Answer

cell1=[1 1 1; 1 1 1; 1 1 1];
cell2=[0 0 0; 0 0 0; 0 0 0];
ii1=[2 2]
ii2=[2 2]
cell1(ii1(1),ii1(2))=cell2(ii1(1),ii1(2))