필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to do the iterative work?

조회 수: 3 (최근 30일)
tabw
tabw 2014년 9월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
for example, matrix(1,1,1)=0;
next matrix(1,2,1)=1 ... matrix(1,100,1)=215;
Next matrix(2,1,1)= 124;
until matrix(10,10,1)=512;
Basically, I want to store many value into matrix
can I use matrix(i,i,1)?
  댓글 수: 1
Adam
Adam 2014년 9월 2일
Beware with your indices though.
matrix( 77, 99, 1000 ) = 7;
will quietly go away and create a matrix of > 7.6 million values (zeros) just to put the number 7 in its final location.
On numerous occasions I have accidentally got a matrix index calculation wrong and had to power my machine off after it froze out of memory!

답변 (1개)

Iain
Iain 2014년 9월 2일
Pretty much yeah,
matrix(i,i,1) = 5
That will set the element on the ith row and ith column on the 1st slice/page/"whatever you want to call it" to be 5
matrix(i,j,k) = 5
That will set the element on the ith row and jth column on the kth slice/page/"whatever you want to call it" to be 5

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by