How can I change the value of some elements within a matrix

1 view (last 30 days)
Please, I am doing an elememt wise inverse of a matrix, the goal here is for any value that is infinity to be converted to 0. The code below is what I have come up with, but it is not giving me the desired results.
Inf 0.3333 0.1667
>> B =[0, 3, 6]
C= 1./B
if C == Inf
elseif C ~= Inf

Accepted Answer

Ajay Kumar
Ajay Kumar on 11 Jan 2020
B =[0, 3, 6];
C= 1./B;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!