Change all matrix elements from x to 1/x

11 ビュー (過去 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 Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by