필터 지우기
필터 지우기

What does this line does? "H(ind(:,k), ind(:,k))=S"

조회 수: 4 (최근 30일)
Mina
Mina 2014년 6월 26일
답변: Ajay Pherwani 2014년 6월 26일
I am pretty new to matlab and i am trying to understand a certain code required for a university project. i am having a bit of problem understanding what this line does:
H(ind(:,k), ind(:,k))=S

답변 (1개)

Ajay Pherwani
Ajay Pherwani 2014년 6월 26일
assuming k = 4 and ind is an matrix of 4x6(4 rows x 6 columns ) -->ind(:,k) will give u all elements of column 4(value of k) in a single row matrix
assuming you are making a matrix H H(ind(:,k), ind(:,k)) --> that value in 4th column of ind matrix will decide which element will be update in H with the value in S
assuming 1st ind(:,k) = [1 2] 2nd ind(:,k) = [3 4]
then assignments will be like
H(1,3)=S H(1,4)=S H(2,3)=S H(2,4)=S

카테고리

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