How to replace different values with NaN in a matrix.
1 view (last 30 days)
Show older comments
Hey guys,
I have this matrix:
Matrix = [50 51 52 53 54 55; 110 111 112 113 114 115; 1 0 0 1 0 0]'
how can i change the values of the second column to NaN, when there is a zero in the third clumn???
0 Comments
Answers (1)
Stephen23
on 11 Nov 2020
Matrix = [50 51 52 53 54 55; 110 111 112 113 114 115; 1 0 0 1 0 0].'
idx = Matrix(:,3)==0;
Matrix(idx,2) = NaN
See Also
Categories
Find more on NaNs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!