How to replace different values with NaN in a matrix.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Stephen23
2020-11-11
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
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!