필터 지우기
필터 지우기

Change all matrix elements from x to 1/x

조회 수: 14 (최근 30일)
Iakovos Antonoglou
Iakovos Antonoglou 2018년 6월 12일
댓글: Walter Roberson 2020년 4월 25일
Hello, i am trying to change all the elements in a single line matrix from Xj to 1/Xj. Thanks

채택된 답변

Rik
Rik 2018년 6월 12일
X=1./X;
Use a dot for element-wise division and multiplication.
  댓글 수: 3
Walter Roberson
Walter Roberson 2018년 6월 14일
X(5,:) = 1./X(5,:);
Iakovos Antonoglou
Iakovos Antonoglou 2018년 6월 14일
thanks!

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

추가 답변 (1개)

Asieh Daneshi
Asieh Daneshi 2020년 4월 25일
A=rand(n);
A(:,n)=1./A(:,n);
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 4월 25일
This would change a single column, rather than a single line (row). It happens to change the last column, by the way.

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

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by