Replace value from cell from particular index

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

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 10일

0 개 추천

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))

댓글 수: 2

Thanks for the answer , but how to save the
cell1(ii1(1),ii1(2))=cell2(ii1(1),ii1(2))
into new variable like cellresult or cell3
I want to loop the cellresult into sub matrix and then using cell2mat to create new matrix
cell1{i+1,j+1}(2,2)=cell2{i+1,j+1}(2,2)
works for me , Thanks for the answer

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2016년 4월 10일

댓글:

2016년 4월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by