Filter löschen
Filter löschen

Change all matrix elements from x to 1/x

14 Ansichten (letzte 30 Tage)
Iakovos Antonoglou
Iakovos Antonoglou am 12 Jun. 2018
Kommentiert: Walter Roberson am 25 Apr. 2020
Hello, i am trying to change all the elements in a single line matrix from Xj to 1/Xj. Thanks

Akzeptierte Antwort

Rik
Rik am 12 Jun. 2018
X=1./X;
Use a dot for element-wise division and multiplication.
  3 Kommentare
Walter Roberson
Walter Roberson am 14 Jun. 2018
X(5,:) = 1./X(5,:);
Iakovos Antonoglou
Iakovos Antonoglou am 14 Jun. 2018
thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Asieh Daneshi
Asieh Daneshi am 25 Apr. 2020
A=rand(n);
A(:,n)=1./A(:,n);
  1 Kommentar
Walter Roberson
Walter Roberson am 25 Apr. 2020
This would change a single column, rather than a single line (row). It happens to change the last column, by the way.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by