Hello, i am trying to change all the elements in a single line matrix from Xj to 1/Xj. Thanks

 Réponse acceptée

Rik
Rik le 12 Juin 2018
X=1./X;
Use a dot for element-wise division and multiplication.

3 commentaires

Iakovos Antonoglou
Iakovos Antonoglou le 13 Juin 2018
Hey, thanks for taking the time to answer. I see now i did not word the question correctly; I meant in a single line of a matrix,not a matrix with just one line :)
X(5,:) = 1./X(5,:);
Iakovos Antonoglou
Iakovos Antonoglou le 14 Juin 2018
thanks!

Connectez-vous pour commenter.

Plus de réponses (1)

Asieh Daneshi
Asieh Daneshi le 25 Avr 2020

0 votes

A=rand(n);
A(:,n)=1./A(:,n);

1 commentaire

Walter Roberson
Walter Roberson le 25 Avr 2020
This would change a single column, rather than a single line (row). It happens to change the last column, by the way.

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by