필터 지우기
필터 지우기

Add diagonal Value in cell array

조회 수: 1 (최근 30일)
Tha saliem
Tha saliem 2018년 1월 11일
댓글: Tha saliem 2018년 1월 11일
hi
I have following array. I want to add NaN at diagonal position of each cell. LIKE x{1,1}, NaN will be added at x{1,1}(1,1).. for x{1,2}, NaN will be added at x{1,2}(1,2) & so on
x= {[0.79,0.31,0.24,0.71,0.1],[0.79,0.12,0.71,0.62,0.24]}

채택된 답변

Birdman
Birdman 2018년 1월 11일
편집: Birdman 2018년 1월 11일
for i=1:size(x,2)
x{1,i}(i)=NaN;
end
Type
x{1,:}
and see the result.
  댓글 수: 3
Birdman
Birdman 2018년 1월 11일
편집: Birdman 2018년 1월 11일
Then,
x{1,1}(2:end+1)=x{1,1}(1:end);
x{1,2}(2:end+1)=x{1,2}(1:end);
for i=1:size(x,2)
x{1,i}(i)=NaN;
end
Tha saliem
Tha saliem 2018년 1월 11일
Thanks Alot

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by